/* index.css — V1 Home (Xuan paper + mirror) */

:root {
  --ink-bg: #050508;
  --ink-text: rgba(236, 230, 220, 0.9);
  --ink-text-muted: rgba(216, 210, 198, 0.76);
  --ink-accent: rgba(160, 128, 80, 0.6);
}

.page {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  /* background: var(--ink-bg); */
  /* 已移除：使用全局背景 */
  color: var(--ink-text);
}

.intro-mask {
  position: fixed;
  inset: 0;
  background: #08080c;
  z-index: 10;
  opacity: 1;
  transition: opacity 1.2s ease;
  pointer-events: auto;
}

.intro-mask.is-hidden {
  opacity: 0;
  pointer-events: none;
}



/* Hero layout */
.hero {
  position: relative;
  z-index: 4;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12vh 8vw 16vh;
  gap: 28px;
  transition: opacity 600ms ease, filter 600ms ease;
}

.hero__text {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 17px;
}

.hero__content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.hero__title {
  margin: 0;
  font-family: "Bakudai", "Noto Serif TC", serif;
  font-size: clamp(52px, 9.4vw, 116px);
  font-weight: 400;
  letter-spacing: 0.27em;
  color: var(--ink-text);
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

html[lang="en-US"] .hero__title {
  letter-spacing: 0.15em;
}

.hero__lines {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.hero__line {
  margin: 0;
  font-size: clamp(31px, 4.1vw, 48px);
  letter-spacing: 0.24em;
  color: var(--ink-text-muted);
  white-space: pre-wrap;
  line-height: 1.59;
  font-family: "Bakudai", "Noto Serif TC", serif;
}

html[lang="en-US"] .hero__line {
  letter-spacing: 0.07em;
}

.hero__lines--vertical {
  flex-direction: row-reverse;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  width: 100%;
  margin-left: -0.8cm;
}

.hero__text>.hero__content>.hero__lines--vertical {
  margin-top: 1em;
}

.hero__lines--vertical .hero__line {
  writing-mode: vertical-rl;
  text-orientation: upright;
  white-space: pre;
}

.hero__line-group {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 0.25em;
}

.hero__line[data-typewriter] {
  filter: none;
  transform: none;
}

body.page--index .hero__line[data-typewriter].reveal {
  transition: none;
  filter: none;
}

body.page--index .hero__line[data-typewriter].reveal.is-visible {
  opacity: 1;
}

.hero__line[data-typewriter] .typewriter-char {
  opacity: 0;
  display: inline-block;
  animation: typewriterReveal var(--typewriter-duration, 300ms) ease forwards;
  animation-delay: var(--typewriter-delay, 0ms);
}

@keyframes typewriterReveal {
  0% {
    opacity: 0;
    filter: blur(14px);
  }

  40% {
    opacity: 0.9;
    filter: blur(12px);
  }

  80% {
    opacity: 1;
    filter: blur(4px);
  }

  100% {
    opacity: 1;
    filter: blur(0);
  }
}

/* Reflection */
.hero__reflection {
  position: absolute;
  top: calc(100% - 6px);
  left: 50%;
  transform: translateX(-50%) scaleY(-1) translateY(6px);
  transform-origin: top;
  opacity: 0;
  filter: url(#waterRipple);
  mask-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), transparent 75%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), transparent 75%);
  pointer-events: none;
  z-index: 1;
  animation: reflectionFade 1.2s ease 1.05s forwards;
}

.hero__reflection.ink-morph-reflection {
  opacity: 0;
  animation: none;
  transition: opacity 900ms ease;
}

.hero__reflection.ink-morph-reflection.is-visible {
  opacity: 0.28;
}

.hero__reflection .hero__title,
.hero__reflection .hero__line {
  color: rgba(200, 196, 186, 0.55);
}

@keyframes reflectionFade {
  to {
    opacity: 0.28;
  }
}

/* Reveal animations */
.reveal {
  opacity: 0;
  filter: blur(var(--reveal-blur, 8px));
  transform: translateY(var(--reveal-y, 0px));
  transition:
    opacity var(--reveal-duration, 800ms) ease,
    filter var(--reveal-duration, 800ms) ease,
    transform var(--reveal-duration, 800ms) ease;
}

.reveal.is-visible {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

.hero__title.reveal {
  --reveal-duration: 4000ms;
  --reveal-blur: 8px;
}

.hero__line.reveal {
  --reveal-duration: 4200ms;
  --reveal-blur: 6px;
}

body.page--index .cta.reveal {
  transition:
    opacity var(--reveal-duration, 3600ms) ease,
    filter var(--reveal-duration, 3600ms) ease,
    transform var(--reveal-duration, 3600ms) ease;
}

/* CTA styles moved to spa.css */

/* Language switch */
.lang-switch {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 6;
  display: flex;
  gap: 8px;
  opacity: 1;
  transition: opacity 500ms ease;
}

.lang-switch--hidden {
  opacity: 0;
  pointer-events: none;
}

.lang-switch button {
  background: rgba(8, 8, 10, 0.4);
  border: 1px solid rgba(160, 128, 80, 0.35);
  color: rgba(226, 220, 208, 0.7);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.lang-switch button.is-active {
  border-color: rgba(160, 128, 80, 0.7);
  color: rgba(240, 234, 222, 0.9);
}

.dev-channel-panel {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 280px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(210, 195, 165, 0.28);
  background: rgba(10, 10, 14, 0.68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.dev-channel-title {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(235, 228, 215, 0.92);
}

.dev-channel-btn {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(210, 195, 165, 0.28);
  border-radius: 10px;
  background: rgba(26, 22, 16, 0.74);
  color: rgba(240, 233, 220, 0.95);
  padding: 8px 10px;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.dev-channel-btn--api {
  border-color: rgba(170, 138, 92, 0.45);
}

.dev-channel-btn:hover {
  border-color: rgba(229, 213, 181, 0.5);
}

.dev-channel-btn:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.85);
  outline-offset: 2px;
}

.dev-channel-btn--user {
  border-color: rgba(142, 170, 136, 0.42);
}

.dev-channel-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dev-channel-field-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: rgba(225, 219, 208, 0.84);
}

.dev-channel-input {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(210, 195, 165, 0.3);
  border-radius: 10px;
  background: rgba(8, 8, 12, 0.76);
  color: rgba(245, 238, 225, 0.94);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
}

.dev-channel-input::placeholder {
  color: rgba(220, 211, 195, 0.5);
}

.dev-channel-input:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.85);
  outline-offset: 1px;
}

.dev-channel-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  letter-spacing: 0.02em;
  color: rgba(214, 205, 188, 0.7);
}

@media (max-width: 768px) {
  .hero {
    padding: 10vh 10vw 18vh;
  }

  .hero__title {
    letter-spacing: 0.22em;
  }

  .hero__line {
    letter-spacing: 0.2em;
  }

  body.page--index .cta--vertical {
    position: fixed;
    top: auto;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom) + 96px);
    transform: translateX(-50%);
    width: min(76vw, 300px);
    max-width: none;
    margin: 0;
    padding: 12px 20px;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    font-size: clamp(20px, 5vw, 24px);
    letter-spacing: 0.16em;
    z-index: 95;
  }

  body.page--index .cta--vertical .cta-label {
    text-align: center !important;
  }

  body.page--index .cta.reveal {
    --reveal-duration: 900ms;
    --reveal-blur: 4px;
    transition:
      opacity var(--reveal-duration, 900ms) ease,
      filter var(--reveal-duration, 900ms) ease,
      transform var(--reveal-duration, 900ms) ease;
  }
}

/* === 小螢幕優化（480px 以下） === */
/* New Mobile Layout: Horizontal, Right Aligned, Vertical Stack */
@media (max-width: 480px) {
  .dev-channel-panel {
    top: auto;
    bottom: calc(22px + env(safe-area-inset-bottom));
    left: calc(14px + env(safe-area-inset-left));
    max-width: min(92vw, 320px);
    padding: 9px;
  }

  .dev-channel-title {
    font-size: 11px;
  }

  .dev-channel-btn {
    font-size: 12px;
    padding: 8px;
  }

  .dev-channel-input {
    font-size: 12px;
    padding: 7px 8px;
  }

  .hero {
    /* Flex Column Centered */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding-top: 5vh;
    padding-bottom: 5vh;
    gap: 5vh;
    padding-left: 20px;
    padding-right: 20px;
  }

  .hero__title {
    /* Right align, LTR */
    direction: ltr !important;
    text-align: right !important;
    width: 100%;
    /* Keep 1.2x size increase from previous request */
    font-size: clamp(43px, 12vw, 72px);
    letter-spacing: 0.18em;
  }

  .hero__text {
    /* Stack Title and Lines */
    display: flex;
    flex-direction: column;
    width: 100%;
    /* Align items center (inherited from main.hero) but title/lines handle themselves */
  }

  .hero__lines {
    /* Stack lines vertically */
    display: flex;
    flex-direction: column;
    /* Align to Right */
    align-items: flex-end;
    margin-top: 20px;
    gap: 0;
    width: 100%;
  }

  .hero__line-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    writing-mode: horizontal-tb;
    margin: 0;
    padding: 0;
    line-height: normal;
    gap: 0;
  }

  .hero__line {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    margin: 0;
    padding: 0;
    /* Increase line height for spacing - user requested logic */
    line-height: 1.8em !important;
    direction: ltr !important;
    text-align: right !important;
    /* Keep 1.2x size increase */
    font-size: clamp(24px, 5.5vw, 34px);
    letter-spacing: 0.15em;
  }

  /* Reset vertical specific styles */
  .hero__lines--vertical {
    flex-direction: column;
    margin-left: 0;
    width: 100%;
  }

  .hero__lines--vertical .hero__line {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
  }
}

/* === 超小螢幕（375px 以下） === */
@media (max-width: 375px) {
  .hero {
    padding: 6vh 5vw 12vh;
    gap: 16px;
  }

  .hero__title {
    font-size: clamp(32px, 9vw, 48px);
    letter-spacing: 0.15em;
  }

  .hero__line {
    font-size: clamp(16px, 4vw, 22px);
    letter-spacing: 0.12em;
  }

  body.page--index .cta--vertical {
    bottom: calc(env(safe-area-inset-bottom) + 88px);
    width: min(80vw, 286px);
    font-size: clamp(18px, 4.6vw, 21px);
  }

  .lang-switch {
    top: 12px;
    right: 12px;
  }

  .lang-switch button {
    padding: 4px 8px;
    font-size: 12px;
  }
}


@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    filter: none;
    transform: none;
    transition: none;
  }

  .hero__reflection {
    filter: none;
    opacity: 0.22;
    animation: none;
  }
}
