/* Colors — traditional Feng Shui: ink black, imperial gold, cinnabar red */
:root {
  --bg: #17120E;
  --card: #211A14;
  --card-border: rgba(201, 162, 39, 0.18);
  --text: #F2E8D5;
  --text-2: #D8CBB2;
  --text-3: #A99C85;
  --accent: #C9A227;
  --accent-hover: #E0BA45;
  --accent-bg: rgba(201, 162, 39, 0.14);
  --accent-soft: #E6C86A;
  --cinnabar: #A62B1F;
  --header-bg: rgba(23, 18, 14, 0.94);
  --font-body: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-heading: "Playfair Display", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

html.page-home,
body.page-home {
  scroll-snap-type: y proximity;
  scroll-padding-top: 84px;
}

body.page-home main>section {
  scroll-snap-align: start;
  scroll-margin-top: 84px;
}

body.page-home .site-footer {
  scroll-snap-align: end;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 480px at 100% -6%, rgba(201, 162, 39, 0.06), transparent 60%),
    radial-gradient(800px 460px at -8% 106%, rgba(166, 43, 31, 0.07), transparent 60%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, rgba(0, 0, 0, 0) 16%, rgba(0, 0, 0, 0) 84%, rgba(0, 0, 0, 0.32) 100%),
    repeating-linear-gradient(45deg, rgba(201, 162, 39, 0.05) 0 1px, rgba(0, 0, 0, 0) 1px 26px),
    repeating-linear-gradient(-45deg, rgba(201, 162, 39, 0.05) 0 1px, rgba(0, 0, 0, 0) 1px 26px);
  background-attachment: fixed;
  background-repeat: no-repeat, no-repeat, no-repeat, repeat, repeat;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4,
h5,
h6,
.section-title,
.hero-title,
.post-title,
.post-page-title {
  font-family: var(--font-heading);
}

main {
  flex: 1 0 auto;
}

.container {
  max-width: 1150px;
  /* margin: 0 auto; */
  width: 100%;
  padding: 0 1rem;
  align-self: center;
}

.page-home-main {
  max-width: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.page-home-main>#posts {
  /* max-width: 1150px; */
  width: 100%;
  padding: 0 clamp(1rem, 5vw, 4rem);
  align-self: center;
}

.site-header {
  background: linear-gradient(180deg, #221A13 0%, #17120E 100%);
  border-bottom: 1px solid rgba(201, 162, 39, 0.4);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: stretch;
  width: 100%;
}

.site-header .container {
  max-width: none;
  align-self: stretch;
 /* padding: 0 clamp(1rem, 5vw, 4rem); */
}

.site-header,
.site-header * {
  font-family: var(--font-body);
}

.site-header .fa,
.site-header .fa-solid,
.site-header .fa-regular {
  font-family: "Font Awesome 6 Free";
}

.site-header .fa-brands {
  font-family: "Font Awesome 6 Brands";
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  font-family: var(--font-heading);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.nav-toggle:hover {
  border-color: rgba(201, 162, 39, 0.35);
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  color: var(--accent);
}

.nav-toggle:hover .nav-toggle-icon,
.nav-toggle:hover .nav-toggle-icon::before,
.nav-toggle:hover .nav-toggle-icon::after,
.nav-toggle:focus-visible .nav-toggle-icon,
.nav-toggle:focus-visible .nav-toggle-icon::before,
.nav-toggle:focus-visible .nav-toggle-icon::after {
  background: var(--accent);
}

.nav-toggle:focus-visible {
  outline: 2px solid rgba(201, 162, 39, 0.35);
  outline-offset: 2px;
}

.nav-toggle-icon {
  position: relative;
  width: 20px;
  height: 2px;
  background: currentColor;
  display: block;
  border-radius: 2px;
  transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s ease, top 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.nav-toggle-icon::before {
  top: -6px;
}

.nav-toggle-icon::after {
  top: 6px;
}

.nav-toggle.is-open {
  background: transparent;
}

.nav-toggle.is-open .nav-toggle-icon {
  background: transparent;
}

.nav-toggle.is-open .nav-toggle-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle.is-open .nav-toggle-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

.brand {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.35rem;
  color: #ffffff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-text {
  font-family: inherit;
  font-weight: inherit;
  display: inline-block;
  transform: scaleX(0.86) scaleY(1.18);
  transform-origin: left center;
  letter-spacing: 0.01em;
}

.brand-text span {
  font-family: inherit;
  font-weight: inherit;
  /* Original brand purple, shared by dark and light headers */
  color: #7945da;
  margin-left: 0.3rem;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
  border-radius: 50%;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.05));
}

.brand-cn {
  width: 65px;
  height: auto;
  object-fit: contain;
  display: block;
  margin-left: -1.5rem;
  /* Recolor black brush strokes to white; alpha channel (transparent bg) is untouched */
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

nav .nav-link {
  margin-left: 0.5rem;
  color: var(--text-2);
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

nav button.nav-link {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  text-align: left;
  font-weight: 700;
  font-size: 0.85rem;
}

nav button.nav-user-trigger {
  border-left: 1.5px solid rgba(201, 162, 39, 0.35);
  border-right: 1.5px solid rgba(201, 162, 39, 0.35);
  margin-left: 0.7rem;
}

nav .nav-link:hover {
  color: var(--accent-soft);
}

nav .nav-link-dropdown {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.nav-caret {
  display: inline-block;
  font-size: 1rem;
  color: var(--text-3);
  transition: transform 0.15s ease, color 0.15s ease;
  margin-right: -0.3rem;
}

.nav-item-dropdown:hover .nav-caret,
.nav-item-dropdown:focus-within .nav-caret {
  transform: rotate(180deg);
  color: var(--accent-soft);
}

.nav-item {
  display: inline-flex;
  align-items: center;
}

.nav-item-dropdown {
  position: relative;
}

.nav-item-dropdown::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 10px;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--card);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.5rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  z-index: 20;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.nav-item-dropdown:hover .nav-dropdown,
.nav-item-dropdown:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-dropdown-link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.875rem;
}

form .nav-dropdown-link {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

.nav-dropdown-link:hover,
.nav-dropdown-link:focus {
  color: var(--accent-soft);
  background: var(--accent-bg);
  outline: none;
}

.nav-user .nav-dropdown {
  left: auto;
  right: 0;
}

.nav-user-trigger {
  display: inline-flex;
  align-items: center;
  border-left: 1.5px solid rgba(201, 162, 39, 0.35);
  border-right: 1.5px solid rgba(201, 162, 39, 0.35);
}

.nav-user-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  text-transform: capitalize;
  padding: 0.4rem 0.2rem;
  padding-left: 0.4rem;
}

.nav-user-role {
  display: none;
}

.nav-dropdown-link i {
  margin-right: 0.6rem;
  width: 1.1rem;
  text-align: center;
}

.hero-banner {
  position: relative;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(51, 39, 29, 0) 70%, rgba(51, 39, 29, 0.7) 90%, #33271D 100%),
    radial-gradient(70% 60% at 85% 20%, rgba(166, 43, 31, 0.10), transparent 60%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.45) 100%),
    repeating-linear-gradient(45deg, rgba(201, 162, 39, 0.07) 0 1px, rgba(0, 0, 0, 0) 1px 26px),
    repeating-linear-gradient(-45deg, rgba(201, 162, 39, 0.07) 0 1px, rgba(0, 0, 0, 0) 1px 26px),
    #14100C;
  background-repeat: no-repeat, no-repeat, no-repeat, repeat, repeat;
  animation: heroThreadDrift 20s linear infinite;
  width: 100%;
  --hero-overflow: clamp(48px, 8vh, 140px);
  --hero-base-shift: calc(var(--hero-overflow) / -2);
  --hero-parallax: 0px;
  color: #fff;
  border-radius: 0;
  padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 5vw, 4rem);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  grid-template-areas: "text media";
  gap: 1.25rem;
  overflow: hidden;
  min-height: calc(100vh - 64px + var(--hero-overflow));
  min-height: calc(100svh - 64px + var(--hero-overflow));
  align-items: center;
}

.hero-text {
  grid-area: text;
  align-self: center;
  justify-self: start;
  text-align: left;
  max-width: 44rem;
  position: relative;
  z-index: 1;
  transform: translateY(calc(var(--hero-base-shift) + var(--hero-parallax)));
}

.hero-title {
  margin: 0;
  font-size: 2.45rem;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

/* Ampersands inside --font-heading elements (hero/post titles, brand, nav, luopan
   category headings) get a matching Didone serif with a clean classic "&",
   because Playfair's swash ampersand reads as broken at display size */
.amp {
  /* DM Serif Display: same high-contrast Didone look as the Playfair headings, but with a clean classic ampersand */
  font-family: "DM Serif Display", Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.hero-title .cn {
  color: var(--accent-soft);
  letter-spacing: 3px;
  font-size: 2.5rem;
}

.hero-subtitle {
  margin: 0.55rem 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  font-weight: 400;
  font-style: italic;
}

.hero-subtitle a {
  color: var(--accent-soft);
  text-decoration: none;
  transition: text-decoration-color 0.2s ease;
}

.hero-subtitle a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.hero-desc {
  margin: 0.8rem 0 1.5rem;
  margin-right: 1.5rem;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.1rem;
  text-wrap: pretty;
}

.is-ready .hero-title {
  animation: fadeInUp .6s ease-out both;
}

.is-ready .hero-subtitle {
  animation: fadeInUp .65s ease-out .03s both;
}

.is-ready .hero-desc {
  animation: fadeInUp .7s ease-out .05s both;
}

.is-ready .hero-actions {
  animation: fadeInUp .8s ease-out .1s both;
}

html:not(.is-ready) .hero-title,
html:not(.is-ready) .hero-subtitle,
html:not(.is-ready) .hero-desc,
html:not(.is-ready) .hero-actions {
  opacity: 0;
  transform: translateY(10px);
}

.btn-lg {
  padding: 0.7rem 1.1rem;
  font-size: 1rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-media {
  display: flex;
  align-items: center;
  justify-content: center;
  grid-area: media;
  position: relative;
  z-index: 1;
  transform: translateY(calc(var(--hero-base-shift) + var(--hero-parallax)));
  margin-bottom: 1.6rem;
  margin-right: -1rem;
}

.hero-media img {
  width: min(100%, 500px);
  height: auto;
  animation: floatSlow 6s ease-in-out infinite;
}

/* Soft glowing pool beneath the floating yin-yang */
.hero-media::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -16%;
  width: 72%;
  height: 24%;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(201, 162, 39, 0.35) 0%, rgba(166, 43, 31, 0.18) 45%, rgba(0, 0, 0, 0) 75%);
  filter: blur(6px);
  pointer-events: none;
  z-index: -1;
  animation: glowPulse 6s ease-in-out infinite;
}

@keyframes glowPulse {

  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }
}

.hero-bg-accent {
  position: absolute;
  right: -15%;
  top: -10%;
  width: 60%;
  height: 180%;
  background: repeating-linear-gradient(115deg, rgba(201, 162, 39, 0.07) 0 1px, rgba(0, 0, 0, 0) 1px 14px);
  transform: rotate(18deg);
  pointer-events: none;
}

/* Periodic golden "qi" sweep flowing across the hero */
.hero-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(115deg, rgba(0, 0, 0, 0) 42%, rgba(201, 162, 39, 0.12) 50%, rgba(0, 0, 0, 0) 58%);
  background-size: 250% 100%;
  background-repeat: no-repeat;
  animation: heroSweep 7s ease-in-out infinite;
}

@keyframes heroThreadDrift {
  from {
    background-position: 0 0, 0 0, 0 0, 0 0, 0 0;
  }

  to {
    background-position: 0 0, 0 0, 0 0, 52px 52px, -52px 52px;
  }
}

@keyframes heroSweep {
  0% {
    background-position: 130% 0;
  }

  55%,
  100% {
    background-position: -130% 0;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatSlow {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

/* While the preloader overlay is up (html.is-ready is added only after it fades),
   pause the ambient every-frame repaints: they are hidden behind the opaque
   overlay anyway, and freeing the main thread keeps the loader morphing
   smoothly instead of freezing during the initial load burst */
html:not(.is-ready) .hero-banner,
html:not(.is-ready) .hero-banner::after,
html:not(.is-ready) .hero-media img,
html:not(.is-ready) .hero-media::after,
html:not(.is-ready) .hero-bg-accent,
html:not(.is-ready) .faq-hero-image {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-title,
  .hero-subtitle,
  .hero-desc {
    animation: none;
  }

  .hero-media img {
    animation: none;
  }

  .hero-banner .btn-slide,
  .hero-banner .btn-slide::before {
    transition: none;
  }

  html:not(.is-ready) .hero-title,
  html:not(.is-ready) .hero-subtitle,
  html:not(.is-ready) .hero-desc {
    opacity: 1;
    transform: none;
  }
}

.section-header {
  margin-top: 1.8rem;
  margin-bottom: 1.5rem;
  /* max-width: 1150px; */
  width: 100%;
  padding: 0 clamp(1rem, 5vw, 4rem);
  align-self: center;
}

.section-title {
  font-size: 2rem;
  margin: 0;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 40px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr));
  gap: 2rem;
  padding: 1rem 0 2rem;
}

#posts {
  scroll-margin-top: 84px;
}

.post-card {
  background: #FBF7EE;
  border: 1px solid rgba(42, 33, 24, 0.14);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: #2A2118;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;

}

.post-card:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.post-card-image {
  margin: -1rem -1rem 0.5rem -1rem;
  height: 220px;
  overflow: hidden;
}

.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.post-card:hover .post-card-image img {
  transform: scale(1.1);
}

.post-title {
  margin: 0;
  font-size: 1.125rem;
}

.post-title a {
  color: #241C12;
  text-decoration: none;
}

.post-title a:hover {
  color: var(--cinnabar);
}

.post-meta {
  font-size: 0.825rem;
  color: #8a7a5f;
  display: flex;
  align-items: right;
  margin-bottom: -0.3rem;
  margin-top: -0.2rem;
}

.post-excerpt {
  margin: 0.2rem 0 0.2rem;
  color: #5a4c38;
  font-size: 0.9rem;
}

.post-card .btn-outline {
  color: var(--cinnabar);
  border-color: var(--cinnabar);
}

.post-card .btn-outline:hover {
  background: var(--cinnabar);
  color: #FBF7EE;
  border-color: var(--cinnabar);
  box-shadow: 0 4px 12px rgba(166, 43, 31, 0.25);
}

/* Light theme for the individual post pages (Feng Shui tips & MYFAD academy) */
body.page-light {
  /* Light-theme token overrides so var()-driven page stylesheets stay readable */
  --text: #2A2118;
  --text-2: #4A3B28;
  --text-3: #8A7A5F;
  /* Accent tokens intentionally inherit the global theme gold (--accent/--accent-hover/--accent-soft/--accent-bg) */
  --card: #FFFFFF;
  --card-border: rgba(42, 33, 24, 0.14);
  background-color: #F7F1E5;
  background-image:
    radial-gradient(900px 480px at 100% -6%, rgba(166, 43, 31, 0.05), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: #2A2118;
}

body.page-light .section-title,
body.page-light .section-title,
body.page-light .post-page-title,
body.page-light .post-page-title {
  color: #241C12;
}

body.page-light .section-title::after,
body.page-light .section-title::after {
  background: var(--cinnabar);
}

.btn {
  align-self: flex-start;
  background: var(--accent);
  color: #17120E;
  text-decoration: none;
  padding: 0.5rem 0.875rem;
  border-radius: 50px;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.2;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.2s ease;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.btn-outline:hover {
  background: var(--accent);
  color: #17120E;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(201, 162, 39, 0.2);
}

.btn-slide {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--cinnabar);
  color: #F7EFD9;
  transition: color 0.28s ease, border-color 0.28s ease, background 0.28s ease, box-shadow 0.28s ease;
  padding: 0.8rem 1.2rem;
  box-shadow: 0 10px 26px rgba(166, 43, 31, 0.35);
  letter-spacing: 1px;
  font-weight: 600;
}

.btn-slide::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-102%);
  transition: transform 0.32s ease;
  z-index: -1;
}

.btn-slide:hover,
.btn-slide:focus-visible {
  color: #17120E;
  border-color: var(--accent);
  background: transparent;
  box-shadow: 0 14px 32px rgba(166, 43, 31, 0.38);
}

.btn-slide:hover::before,
.btn-slide:focus-visible::before {
  transform: translateX(0);
}

.content {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.form-card {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.form-field label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(201, 162, 39, 0.3);
  border-radius: 10px;
  font: inherit;
  color: var(--text);
  background: #241C15;
}

.input:focus {
  outline: none;
  border-color: rgba(201, 162, 39, 0.55);
  box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.12);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  margin: 0 0 1rem;
  font-weight: 600;
}

.alert-success {
  background: var(--accent-bg);
  border-color: rgba(201, 162, 39, 0.35);
  color: var(--accent-soft);
}

.alert-error {
  background: rgba(166, 43, 31, 0.18);
  border-color: rgba(255, 75, 75, 0.35);
  color: #F0B9B0;
}

.post-page-title {
  margin-top: 0;
}

.post-body {
  color: var(--text-2);
}

.site-footer {
  margin-top: 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(201, 162, 39, 0.3);
  background:
    radial-gradient(60% 120% at 15% 0%, rgba(201, 162, 39, 0.06), transparent 60%),
    repeating-linear-gradient(45deg, rgba(201, 162, 39, 0.04) 0 1px, rgba(0, 0, 0, 0) 1px 26px),
    repeating-linear-gradient(-45deg, rgba(201, 162, 39, 0.04) 0 1px, rgba(0, 0, 0, 0) 1px 26px),
    linear-gradient(180deg, #1A1410 0%, #0E0B08 100%);
  background-repeat: no-repeat, repeat, repeat, no-repeat;
  /* Keep the dark-theme palette inside the footer even on light pages */
  --text-2: #D8CBB2;
  --text-3: #A99C85;
  --accent: #C9A227;
  --accent-soft: #E6C86A;
  color: var(--text-2);
  font-size: 0.875rem;
  display: flex;
  justify-content: center;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
}

/* On light pages the upward shadow reads as a grey smudge on the paper background */
body.page-light .site-footer {
  box-shadow: none;
}

.site-footer .container {
  max-width: none;
  width: 100%;
  padding: 0 clamp(1rem, 5vw, 4rem);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
}

.footer-locale {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-2);
  white-space: nowrap;
}

.footer-locale .icon-globe {
  width: 18px;
  height: 18px;
  display: block;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.85rem;
}

.footer-links a {
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--accent-soft);
}

@media (max-width: 1024px) {
  .hero-banner {
    min-height: 50vh;
    padding: 8rem 2rem 3rem 2rem; 
  }
  .hero-media img {
    max-height: 42vh;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero-title {
    font-size: 2.2rem;
  }
  .hero-desc{
    font-size: 1.05rem;
  }
  .footer-inner {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
  }
  .footer-right {
    flex-direction: column;
    gap: 1rem;
  }
  .btn-slide{
    font-size: 1rem;
  }
}

@media (max-width: 640px) {
  body.nav-open {
    overflow: hidden;
  }

  .footer-inner {
    flex-direction: column;
    align-items: center;
  }

  .footer-right {
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
  }

  .footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.85rem;
    margin-bottom: 0.7rem;
  }

  .nav {
    height: auto;
    padding: 0.8rem 0.9rem;
    padding-right: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .nav-toggle {
    display: inline-flex;
    z-index: 40;
  }

  body.nav-open .nav-toggle {
    position: fixed;
    top: 14px;
    right: 16px;
  }

  body.nav-open .brand {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .site-nav {
    position: fixed;
    inset: 0;
    z-index: 30;
    background:
      repeating-linear-gradient(45deg, rgba(201, 162, 39, 0.05) 0 1px, rgba(0, 0, 0, 0) 1px 26px),
      repeating-linear-gradient(-45deg, rgba(201, 162, 39, 0.05) 0 1px, rgba(0, 0, 0, 0) 1px 26px),
      #17120E;
    background-repeat: repeat, repeat, no-repeat;
    padding: 6rem 1.25rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-16px);
    pointer-events: none;
    transition:
      opacity 0.35s ease,
      transform 0.35s ease,
      visibility 0s linear 0.35s;
  }

  .site-nav .nav-link {
    color: var(--text-2);
  }

  .site-nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition:
      opacity 0.35s ease,
      transform 0.35s ease,
      visibility 0s linear 0s;
  }

  .site-nav .nav-link {
    margin-left: 0;
    padding: 1rem 0.5rem;
    display: block;
    width: min(420px, 100%);
    font-size: 1rem;
    text-align: left;
  }

  .site-nav button.nav-link {
    text-align: left;
  }

  nav button.nav-user-trigger {
    border-left: 0px solid rgba(26, 26, 26, 0.18);
    border-right: 0px solid rgba(26, 26, 26, 0.18);
    margin-left: 0rem;
  }

  .site-nav .nav-item {
    display: block;
    width: min(420px, 100%);
  }

  .site-nav .nav-item-dropdown::after {
    display: none;
  }

  .site-nav .nav-dropdown {
    position: static;
    top: auto;
    left: auto;
    min-width: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0.25rem 0 0.25rem 0.5rem;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
  }

  .site-nav .nav-dropdown-link {
    padding: 1rem 0.5rem;
    font-size: 1rem;
    text-align: left;
  }

  .site-nav .nav-user.is-admin {
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
    margin-top: 0.25rem;
  }

  .site-nav .nav-user.is-admin .nav-user-trigger {
    width: 100%;
    margin-left: 0;
    padding: 1rem 1.2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
  }

  .site-nav .nav-user.is-admin .nav-user-trigger i {
    width: 1.1rem;
    text-align: center;
  }

  .site-nav .nav-user.is-admin .nav-user-name {
    max-width: none;
    padding: 0;
  }

  .site-nav .nav-user.is-admin .nav-user-role {
    display: inline-flex;
    align-items: center;
    margin-left: 0.35rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: rgba(201, 162, 39, 0.35);
    color: var(--accent-soft);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.4px;
  }

  .site-nav .nav-user.is-admin .nav-dropdown {
    padding: 0.45rem;
    border-top: 1px solid var(--card-border);
  }

  .site-nav .nav-user.is-admin .nav-dropdown-link {
    padding: 0.65rem 0.75rem;
  }

  .hero-title {
    font-size: 2rem;
    margin-bottom: 0.6rem;
  }

  .hero-title .cn {
    color: var(--accent-soft);
    letter-spacing: 3px;
    font-size: 2rem;
    font-weight: 500;
  }

  .hero-desc {
    font-size: 1.15rem;
    margin-top: 0.5rem;
    margin-bottom: 1.2rem;
  }

  .hero-banner {
    grid-template-columns: 1fr;
    grid-template-areas:
      "media"
      "text";
    padding: 2rem 1.25rem;
    gap: 1.25rem;
    min-height: calc(100vh - 64px);
    min-height: calc(100svh - 64px);
    display: flex;
    flex-direction: column-reverse;
    justify-content: center;
  }

  .hero-text,
  .hero-media {
    transform: none;
  }

  .hero-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    width: calc(100% + 2.5rem);
    margin-bottom: -1rem;
    margin-top: -2rem;
  }

  .hero-media img {
    width: auto;
    max-height: 40vh;
    padding-bottom: 0;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .hero-bg-accent {
    position: absolute;
    right: -25%;
    top: -70%;
    width: 95%;
    height: 180%;
    background: repeating-linear-gradient(115deg, rgba(201, 162, 39, 0.07) 0 1px, rgba(0, 0, 0, 0) 1px 14px);
    transform: rotate(14deg);
    pointer-events: none;
  }
}

@media screen and (max-width: 376px) {
  .hero-title .cn {
    color: var(--accent-soft);
    letter-spacing: 3px;
    font-size: 1.5rem;
    font-weight: 500;
  }

  .hero-desc {
    font-size: 0.92rem;
  }
}

.toast {
  position: fixed;
  top: 76px;
  right: 1rem;
  z-index: 1000;
  min-width: 260px;
  max-width: calc(100% - 2rem);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast .toast-close {
  margin-left: auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.toast .toast-close:hover,
.toast .toast-close:focus-visible {
  background: rgba(201, 162, 39, 0.12);
  outline: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ---------- Motion & reveal animations ---------- */
@keyframes bgDrift {
  from {
    background-position: 0 0, 0 0, 0 0, 0 0, 0 0;
  }

  to {
    background-position: 0 0, 0 0, 0 0, 52px 52px, -52px 52px;
  }
}

body {
  animation: bgDrift 48s linear infinite;
}

@keyframes accentBreathe {

  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 1;
  }
}

.hero-bg-accent {
  animation: accentBreathe 8s ease-in-out infinite;
}

/* Nav link underline sweep on hover */
nav .nav-link {
  position: relative;
}

nav .nav-link::after {
  content: "";
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  bottom: 0.12rem;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.25s ease;
}

nav .nav-link:hover::after,
nav .nav-link:focus-visible::after {
  transform: scaleX(1);
}

/* Scroll-reveal (only active once JS marks the document ready) */
html.reveal-ready .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

html.reveal-ready .reveal.is-in {
  opacity: 1;
  transform: none;
}

html.reveal-ready .grid .reveal:nth-child(2) {
  transition-delay: 0.12s;
}

html.reveal-ready .grid .reveal:nth-child(3) {
  transition-delay: 0.24s;
}

/* Section-title underline grows when its header scrolls into view */
html.reveal-ready .section-title::after {
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.6s ease 0.25s;
}

html.reveal-ready .section-header.is-in .section-title::after {
  transform: scaleX(1);
}

/* Card hover gains a gold edge */
.post-card:hover {
  border-color: rgba(201, 162, 39, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
  }

  .hero-banner {
    animation: none;
  }

  .hero-banner::after {
    animation: none;
  }

  .hero-bg-accent {
    animation: none;
  }

  .hero-media::after {
    animation: none;
  }

  nav .nav-link::after {
    transition: none;
  }

  html.reveal-ready .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  html.reveal-ready .section-title::after {
    transform: scaleX(1);
    transition: none;
  }
}

/* ---------- Light header for light (rice-paper) article pages ---------- */
body.page-light .site-header,
body.page-light .site-header {
  background: linear-gradient(180deg, #FDFAF1 0%, #F7F1E5 100%);
  border-bottom: 1px solid rgba(166, 43, 31, 0.25);
  box-shadow: 0 6px 24px rgba(42, 33, 24, 0.12);
}

body.page-light .brand,
body.page-light .brand {
  color: #241C12;
}

/* Calligraphy returns to its original ink strokes on the light header */
body.page-light .brand-cn,
body.page-light .brand-cn {
  filter: none;
  opacity: 0.85;
}

body.page-light nav .nav-link,
body.page-light nav .nav-link {
  color: #4A3B28;
}

body.page-light nav .nav-link:hover,
body.page-light nav .nav-link:hover,
body.page-light nav .nav-link:focus-visible,
body.page-light nav .nav-link:focus-visible {
  color: var(--cinnabar);
}

body.page-light nav .nav-link::after,
body.page-light nav .nav-link::after {
  background: var(--cinnabar);
}

body.page-light .nav-caret,
body.page-light .nav-caret {
  color: #8A7A5F;
}

body.page-light .nav-toggle,
body.page-light .nav-toggle {
  color: #241C12;
}

body.page-light .nav-toggle:hover,
body.page-light .nav-toggle:hover,
body.page-light .nav-toggle:focus-visible,
body.page-light .nav-toggle:focus-visible {
  color: var(--cinnabar);
}

body.page-light .nav-toggle:hover .nav-toggle-icon,
body.page-light .nav-toggle:hover .nav-toggle-icon,
body.page-light .nav-toggle:hover .nav-toggle-icon::before,
body.page-light .nav-toggle:hover .nav-toggle-icon::before,
body.page-light .nav-toggle:hover .nav-toggle-icon::after,
body.page-light .nav-toggle:hover .nav-toggle-icon::after,
body.page-light .nav-toggle:focus-visible .nav-toggle-icon,
body.page-light .nav-toggle:focus-visible .nav-toggle-icon,
body.page-light .nav-toggle:focus-visible .nav-toggle-icon::before,
body.page-light .nav-toggle:focus-visible .nav-toggle-icon::before,
body.page-light .nav-toggle:focus-visible .nav-toggle-icon::after,
body.page-light .nav-toggle:focus-visible .nav-toggle-icon::after {
  background: var(--cinnabar);
}

body.page-light .nav-user-trigger,
body.page-light .nav-user-trigger {
  border-left-color: rgba(166, 43, 31, 0.35);
  border-right-color: rgba(166, 43, 31, 0.35);
}

body.page-light .nav-dropdown,
body.page-light .nav-dropdown {
  background: #FDFAF1;
  border-color: rgba(42, 33, 24, 0.14);
  box-shadow: 0 16px 40px rgba(42, 33, 24, 0.18);
}

body.page-light .nav-dropdown-link,
body.page-light .nav-dropdown-link {
  color: #4A3B28;
}

body.page-light .nav-dropdown-link:hover,
body.page-light .nav-dropdown-link:hover,
body.page-light .nav-dropdown-link:focus,
body.page-light .nav-dropdown-link:focus {
  color: var(--cinnabar);
  background: rgba(166, 43, 31, 0.08);
}

@media (max-width: 640px) {

  body.page-light .site-nav,
  body.page-light .site-nav {
    background: #F7F1E5;
  }
}

/* ---------- Homepage: line-free, lighter About Us backdrop ---------- */
body.page-home {
  background-color: #33271D;
  background-image:
    radial-gradient(900px 480px at 100% -6%, rgba(201, 162, 39, 0.06), transparent 60%),
    radial-gradient(800px 460px at -8% 106%, rgba(166, 43, 31, 0.07), transparent 60%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, rgba(0, 0, 0, 0) 16%, rgba(0, 0, 0, 0) 84%, rgba(0, 0, 0, 0.32) 100%);
  background-repeat: no-repeat, no-repeat, no-repeat;
  animation: none;
}