:root {
  --tm-bg: #f4f1ea;
  --tm-bg-veil: rgba(244, 241, 234, 0);
  --tm-surface: rgba(255, 255, 255, 0.48);
  --tm-surface-hover: rgba(255, 255, 255, 0.78);
  --tm-ink: #1c1a17;
  --tm-ink-muted: #7d776d;
  --tm-meta: #b0a99d;
  --tm-hairline: rgba(28, 26, 23, 0.12);
  --tm-hairline-soft: rgba(28, 26, 23, 0.07);
  --tm-inset: rgba(28, 26, 23, 0.06);
  --tm-accent-ink: #ffffff;
  --tm-shadow: 0 10px 30px rgba(28, 26, 23, 0.07);

  --tm-r-sm: 8px;
  --tm-r: 14px;
  --tm-pill: 999px;
  --tm-touch-target: 44px;
  --tm-gutter: max(clamp(20px, 5vw, 40px), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --tm-shell: min(100%, 940px);

  --tm-serif: 'Songti SC', 'Songti TC', 'Noto Serif SC', 'Noto Serif TC', 'Hiragino Mincho ProN', Georgia, serif;
  --tm-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans', 'Noto Sans SC', Roboto, sans-serif;
  --tm-mono: 'SF Mono', ui-monospace, 'Cascadia Code', Menlo, monospace;

  --tm-fast: 140ms;
  --tm-normal: 240ms;
  --tm-slow: 520ms;
  --tm-ease: cubic-bezier(0.2, 0, 0, 1);
  --tm-settle: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tm-bg: #1c1b18;
    --tm-bg-veil: rgba(28, 27, 24, 0);
    --tm-surface: rgba(255, 255, 255, 0.04);
    --tm-surface-hover: rgba(255, 255, 255, 0.08);
    --tm-ink: #ece3d0;
    --tm-ink-muted: #9c948a;
    --tm-meta: #7c756a;
    --tm-hairline: rgba(236, 227, 208, 0.14);
    --tm-hairline-soft: rgba(236, 227, 208, 0.08);
    --tm-inset: rgba(236, 227, 208, 0.06);
    --tm-accent-ink: #1c1b18;
    --tm-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);

    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 var(--tm-gutter);
  background: var(--tm-bg);
  color: var(--tm-ink);
  font-family: var(--tm-sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
select {
  font: inherit;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  width: var(--tm-shell);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: var(--tm-touch-target);
  padding: 22px 0 0;
}

.lang-select {
  min-height: 36px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--tm-hairline);
  border-radius: var(--tm-pill);
  background-color: transparent;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 1px), calc(100% - 11px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--tm-ink-muted);
  appearance: none;
  cursor: pointer;
  font-size: 13px;
  transition: border-color var(--tm-fast) var(--tm-ease), color var(--tm-fast) var(--tm-ease);
}

.lang-select:hover {
  border-color: var(--tm-ink-muted);
  color: var(--tm-ink);
}

.lang-select:focus-visible {
  outline: 2px solid var(--tm-ink);
  outline-offset: 2px;
}

/* ---------- hero ---------- */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 68px 0;
}

.hero-title-stack {
  position: relative;
  isolation: isolate;
}

.hero-title {
  margin: 0;
  font-family: var(--tm-serif);
  font-size: clamp(3.1rem, 11vw, 6.4rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: 0.01em;
}

.hero-mirror {
  position: relative;
  display: block;
  height: 0.44em;
  overflow: hidden;
  font-size: clamp(3.1rem, 11vw, 6.4rem);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 88%);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 88%);
  pointer-events: none;
  user-select: none;
}

.hero-mirror-inner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  font-family: var(--tm-serif);
  font-size: 1em;
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: 0.01em;
  color: var(--tm-ink);
  opacity: 0.11;
  transform: scaleY(-1);
}

.hero-tagline {
  margin: 26px 0 0;
  max-width: 46ch;
  font-family: var(--tm-serif);
  font-size: clamp(1.1rem, 3.2vw, 1.5rem);
  font-style: italic;
  line-height: 1.5;
  color: var(--tm-ink);
}

.hero-rule {
  height: 1px;
  margin: 34px 0 0;
  background: var(--tm-hairline);
  transform-origin: left center;
}

/* ---------- channels ---------- */

.section-label {
  margin: 26px 0 14px;
  color: var(--tm-meta);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.channel-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 108px;
  padding: 16px 18px;
  border: 1px solid var(--tm-hairline-soft);
  border-radius: var(--tm-r);
  background: var(--tm-surface);
  transition: transform var(--tm-normal) var(--tm-settle), background var(--tm-normal) var(--tm-ease),
    border-color var(--tm-normal) var(--tm-ease), box-shadow var(--tm-normal) var(--tm-ease);
}

.channel-card:hover,
.channel-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--tm-hairline);
  background: var(--tm-surface-hover);
  box-shadow: var(--tm-shadow);
}

.channel-card:focus-visible {
  outline: 2px solid var(--tm-ink);
  outline-offset: 2px;
}

.channel-name {
  font-family: var(--tm-serif);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.3;
}

.channel-handle {
  color: var(--tm-ink-muted);
  font-size: 0.9rem;
}

.channel-id {
  margin-top: auto;
  color: var(--tm-meta);
  font-family: var(--tm-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.channel-arrow {
  position: absolute;
  top: 16px;
  right: 16px;
  color: var(--tm-meta);
  font-size: 13px;
  line-height: 1;
  transition: transform var(--tm-normal) var(--tm-settle), color var(--tm-normal) var(--tm-ease);
}

.channel-card:hover .channel-arrow,
.channel-card:focus-visible .channel-arrow {
  transform: translate(2px, -2px);
  color: var(--tm-ink);
}

/* ---------- contact ---------- */

.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--tm-hairline-soft);
}

.contact-label {
  color: var(--tm-ink-muted);
  font-size: 0.94rem;
}

.contact-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--tm-hairline);
  border-radius: var(--tm-pill);
  background: transparent;
  cursor: pointer;
  font-family: var(--tm-mono);
  font-size: 13px;
  transition: background var(--tm-fast) var(--tm-ease), border-color var(--tm-fast) var(--tm-ease);
}

.contact-copy:hover {
  border-color: var(--tm-ink-muted);
  background: var(--tm-inset);
}

.contact-copy:focus-visible {
  outline: 2px solid var(--tm-ink);
  outline-offset: 2px;
}

.contact-copy-hint {
  color: var(--tm-meta);
  font-family: var(--tm-sans);
  font-size: 12px;
}

/* ---------- entrance ---------- */

.reveal {
  opacity: 0;
  transform: translate3d(0, 12px, 0);
}

body.is-ready .reveal {
  animation: tm-rise var(--tm-slow) var(--tm-settle) forwards;
  animation-delay: var(--reveal-delay, 0ms);
}

body.is-ready .hero-rule {
  animation: tm-rule var(--tm-slow) var(--tm-ease) forwards;
  animation-delay: 240ms;
  transform: scaleX(0);
}

@keyframes tm-rise {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes tm-rule {
  to {
    transform: scaleX(1);
  }
}

/* ---------- 404 ---------- */

.not-found {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 68px 0;
}

.not-found-code {
  margin: 0;
  color: var(--tm-meta);
  font-family: var(--tm-mono);
  font-size: 13px;
  letter-spacing: 0.16em;
}

.not-found-title {
  margin: 0;
  font-family: var(--tm-serif);
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 600;
  line-height: 1.2;
}

.not-found-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: var(--tm-touch-target);
  margin-top: 10px;
  padding: 0 20px;
  border-radius: var(--tm-pill);
  background: var(--tm-ink);
  color: var(--tm-accent-ink);
  font-size: 14px;
}

@media (max-width: 640px) {
  .hero {
    padding: 48px 0;
  }

  .contact {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  body.is-ready .hero-rule {
    transform: scaleX(1);
  }
}
