/* Cyber Grimoire — Minimalist Celestial Velvet & Integrated 2.5D Cards */
@font-face {
  font-family: 'Rajdhani';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('./fonts/rajdhani-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Rajdhani';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('./fonts/rajdhani-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Rajdhani';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('./fonts/rajdhani-latin-700-normal.woff2') format('woff2');
}

:root {
  --bg: #050710;
  --hairline: rgba(232, 199, 130, 0.2);
  --hairline-soft: rgba(186, 204, 246, 0.12);
  --ivory: #f5f6fb;
  --muted: #98a4c2;
  --dim: #627094;
  --gold: #e8c782;
  --gold-bright: #fff4d2;
  --cyan: #67dce3;

  --font-serif: 'Noto Serif TC', 'Source Han Serif TC', 'Songti TC', Georgia, serif;
  --font-num: 'Rajdhani', 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  --font-sans: 'PingFang TC', 'Noto Sans TC', 'Noto Sans CJK TC', 'Microsoft JhengHei', system-ui, sans-serif;
  --container-w: 1180px;
  --nav-h: 70px;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg);
  color: var(--ivory);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(960px 560px at 74% -6%, rgba(203, 166, 255, 0.11), transparent 60%),
    radial-gradient(880px 520px at 18% 18%, rgba(232, 199, 130, 0.08), transparent 62%),
    #050710;
  color: var(--ivory);
  overflow-x: hidden;
}

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

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

button {
  cursor: pointer;
}

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

:focus-visible {
  outline: 1.5px solid var(--gold);
  outline-offset: 3px;
}

.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.serif {
  font-family: var(--font-serif);
}

.container {
  position: relative;
  z-index: 2;
  width: min(100% - 40px, var(--container-w));
  margin: 0 auto;
}

/* ---- Sandbox Watermark ---- */
.sandbox-watermark {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  background-repeat: repeat;
  background-size: 320px 200px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='200' viewBox='0 0 320 200'%3E%3Ctext x='80' y='50' transform='rotate(-24 80 50)' text-anchor='middle' dominant-baseline='central' font-family='ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif' font-size='22' font-weight='800' letter-spacing='5' fill='rgba(245, 200, 100, 0.16)' stroke='rgba(6, 9, 20, 0.28)' stroke-width='2.5' paint-order='stroke'%3ESANDBOX%3C/text%3E%3Ctext x='240' y='150' transform='rotate(-24 240 150)' text-anchor='middle' dominant-baseline='central' font-family='ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif' font-size='22' font-weight='800' letter-spacing='5' fill='rgba(245, 200, 100, 0.16)' stroke='rgba(6, 9, 20, 0.28)' stroke-width='2.5' paint-order='stroke'%3ESANDBOX%3C/text%3E%3C/svg%3E");
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  border: 1px solid var(--hairline);
  background: rgba(12, 16, 32, 0.65);
  color: var(--ivory);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
}

.btn-gold {
  background: linear-gradient(135deg, #fff4d2 0%, #e8c782 54%, #c99d49 100%);
  color: #161005;
  border-color: rgba(255, 244, 210, 0.9);
  box-shadow: 0 10px 30px rgba(232, 199, 130, 0.24);
}

.btn-gold:hover {
  box-shadow: 0 14px 36px rgba(232, 199, 130, 0.38);
}

.btn-hairline {
  background: transparent;
  border-color: rgba(245, 246, 251, 0.25);
}

.btn-hairline:hover {
  color: var(--gold-bright);
  background: rgba(232, 199, 130, 0.07);
}

.btn-sm {
  padding: 8px 18px;
  font-size: 13px;
}

/* ---- Minimal Floating Header ---- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: var(--nav-h);
  background: linear-gradient(180deg, rgba(5, 7, 16, 0.78) 0%, rgba(5, 7, 16, 0) 100%);
  border-bottom: 1px solid transparent;
  transition: background 0.24s ease, border-color 0.24s ease, backdrop-filter 0.24s ease;
}

.site-header.scrolled,
.site-header.subpage {
  background: rgba(5, 7, 16, 0.88);
  border-bottom-color: var(--hairline);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gold-bright);
}

.brand-sub {
  font-family: var(--font-num);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(245, 246, 251, 0.72);
  transition: color 0.18s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--gold-bright);
}

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  background: rgba(10, 15, 33, 0.8);
}

.mobile-drawer {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  z-index: 39;
  padding: 18px 20px 24px;
  background: rgba(5, 7, 16, 0.97);
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(18px);
}

.mobile-drawer.open {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---- Live 2.5D Card Layering & Shader Host ---- */
.live-card {
  position: relative;
  aspect-ratio: 2 / 3;
  cursor: pointer;
  perspective: 960px;
}

.card-tilt-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
}

.card-fallback {
  position: absolute;
  inset: 0;
  transition: opacity 0.28s ease;
}

.live-card.shader-ready .card-fallback {
  opacity: 0;
  pointer-events: none;
}

.card-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.card-layer.bg,
.card-layer.char {
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.card-layer.frame {
  object-fit: fill;
}

.card-shader-canvas {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 24px 44px rgba(0, 0, 0, 0.84));
}

/* ---- Cinematic Hero with Organic Floating Cards ---- */
.hero {
  position: relative;
  min-height: min(94vh, 860px);
  padding-top: calc(var(--nav-h) + 20px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center 24%;
  opacity: 0.3;
  filter: saturate(1.05) brightness(0.72);
}

.hero-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 72% 44%, rgba(203, 166, 255, 0.2), transparent 46%),
    linear-gradient(90deg, rgba(5, 7, 16, 0.96) 0%, rgba(5, 7, 16, 0.72) 50%, rgba(5, 7, 16, 0.36) 100%),
    linear-gradient(180deg, rgba(5, 7, 16, 0.5) 0%, rgba(5, 7, 16, 0.12) 48%, rgba(5, 7, 16, 1) 100%);
}

.hero-astrolabe {
  position: absolute;
  right: 4%;
  top: 50%;
  width: min(640px, 64vw);
  aspect-ratio: 1;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
  opacity: 0.22;
  color: var(--gold);
  animation: slowSpin 110s linear infinite;
}

@keyframes slowSpin {
  from { transform: translateY(-50%) rotate(0deg); }
  to { transform: translateY(-50%) rotate(360deg); }
}

.hero-main {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: center;
  gap: 24px;
  padding: 16px 0 24px;
}

.hero-logo {
  width: min(460px, 92%);
  margin: 0 0 18px;
  filter: drop-shadow(0 16px 36px rgba(0, 0, 0, 0.74));
}

.hero-subline {
  margin: 0 0 28px;
  font-family: var(--font-serif);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 600;
  letter-spacing: 0.14em;
  color: rgba(245, 246, 251, 0.88);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.hero-visual {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 540px;
}

.hero-mascot {
  position: relative;
  z-index: 2;
  max-height: min(74vh, 660px);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 24px 52px rgba(0, 0, 0, 0.8));
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
}

.hero-float-card {
  position: absolute;
  z-index: 3;
}

.hero-float-card.left {
  left: -6px;
  bottom: 42px;
  width: 174px;
  transform: rotate(-3deg);
  animation: floatLeft 7s ease-in-out infinite;
}

.hero-float-card.right {
  right: 0;
  bottom: 72px;
  width: 162px;
  transform: rotate(3.5deg);
  animation: floatRight 8s ease-in-out infinite;
}

@keyframes floatLeft {
  0%, 100% { transform: rotate(-3deg) translateY(0); }
  50% { transform: rotate(-2deg) translateY(-8px); }
}

@keyframes floatRight {
  0%, 100% { transform: rotate(3.5deg) translateY(0); }
  50% { transform: rotate(2.5deg) translateY(-10px); }
}

.hero-ticker {
  position: relative;
  z-index: 3;
  border-top: 1px solid var(--hairline-soft);
  border-bottom: 1px solid var(--hairline-soft);
  background: rgba(5, 7, 16, 0.78);
  backdrop-filter: blur(12px);
}

.hero-ticker-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.ticker-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.ticker-title {
  font-size: 13.5px;
  color: var(--ivory);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticker-link:hover .ticker-title {
  color: var(--gold-bright);
}

.ticker-all {
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

/* ---- News Section with Integrated 2.5D Card Anchor ---- */
.section {
  position: relative;
  padding: 86px 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
}

.section-heading {
  margin: 6px 0 0;
  font-family: var(--font-serif);
  font-size: clamp(24px, 2.8vw, 32px);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
}

.news-split {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}

.news-card-anchor {
  position: relative;
  width: 268px;
  margin: 0 auto;
}

.news-card-anchor::before {
  content: '';
  position: absolute;
  inset: -28px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 199, 130, 0.16) 0%, rgba(103, 220, 227, 0.06) 46%, transparent 72%);
  pointer-events: none;
}

.news-wrap {
  max-width: 860px;
  margin: 0 auto;
}

.news-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.bulletin-list {
  border-top: 1px solid var(--hairline);
}

.bulletin-row {
  display: grid;
  grid-template-columns: 108px 78px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 14px;
  padding: 20px 10px;
  border-bottom: 1px solid var(--hairline-soft);
  transition: background 0.18s ease, border-color 0.18s ease, padding-left 0.18s ease;
}

.bulletin-row:hover {
  background: rgba(232, 199, 130, 0.04);
  border-bottom-color: var(--hairline);
  padding-left: 16px;
}

.bulletin-row[hidden] {
  display: none;
}

.bulletin-date {
  font-family: var(--font-num);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.bulletin-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ivory);
  min-width: 0;
}

.bulletin-title span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bulletin-arrow {
  color: var(--gold);
  opacity: 0.6;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.bulletin-row:hover .bulletin-arrow {
  transform: translateX(4px);
  opacity: 1;
}

.cat-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.tone-gold {
  color: var(--gold-bright);
  background: rgba(232, 199, 130, 0.12);
  border-color: rgba(232, 199, 130, 0.35);
}

.tone-magenta {
  color: #ffd7eb;
  background: rgba(239, 126, 183, 0.12);
  border-color: rgba(239, 126, 183, 0.35);
}

.tone-cyan {
  color: #cef9fc;
  background: rgba(103, 220, 227, 0.12);
  border-color: rgba(103, 220, 227, 0.35);
}

.tone-violet {
  color: #ebe0ff;
  background: rgba(182, 148, 246, 0.12);
  border-color: rgba(182, 148, 246, 0.35);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 2px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--hairline-soft);
}

/* ---- Subpages & Prose ---- */
.page-banner {
  padding: calc(var(--nav-h) + 46px) 0 32px;
  border-bottom: 1px solid var(--hairline);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.breadcrumb a:hover {
  color: var(--gold-bright);
}

.news-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline-soft);
}

.filter-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--hairline-soft);
  border-radius: 4px;
  background: rgba(10, 15, 33, 0.7);
}

.filter-pill {
  height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.16s ease;
}

.filter-pill:hover {
  color: var(--ivory);
  background: rgba(255, 255, 255, 0.05);
}

.filter-pill.active {
  color: var(--gold-bright);
  border-color: var(--hairline);
  background: rgba(232, 199, 130, 0.14);
}

.search-box {
  position: relative;
  flex: 1 1 200px;
  max-width: 290px;
  margin-left: auto;
}

.search-box svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 34px;
  border-radius: 3px;
  border: 1px solid var(--hairline-soft);
  background: rgba(10, 15, 33, 0.85);
  color: var(--ivory);
  font-size: 13.5px;
}

.article-shell {
  padding: calc(var(--nav-h) + 36px) 0 80px;
}

.article-surface {
  padding: 34px 40px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: rgba(10, 15, 33, 0.72);
}

.article-cover {
  margin: 22px 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--hairline-soft);
  max-height: 420px;
}

.article-cover img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}

.md-prose {
  font-size: 15.5px;
  line-height: 1.82;
  color: #dfe6f8;
}

.md-prose h2,
.md-prose h3,
.md-prose h4 {
  font-family: var(--font-serif);
  color: var(--gold-bright);
  margin: 1.6em 0 0.6em;
  line-height: 1.35;
}

.md-prose h2 {
  font-size: 22px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hairline);
}

.md-prose h3 {
  font-size: 18px;
  color: var(--cyan);
}

.md-prose p {
  margin: 0 0 1em;
}

.md-prose ul,
.md-prose ol {
  margin: 0 0 1.1em;
  padding-left: 1.5em;
}

.md-prose li {
  margin-bottom: 0.45em;
}

.md-prose a {
  color: var(--gold-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.md-prose blockquote {
  margin: 1.2em 0;
  padding: 12px 18px;
  border-left: 2px solid var(--gold);
  background: rgba(232, 199, 130, 0.07);
  color: var(--gold-bright);
}

.md-prose blockquote p:last-child {
  margin-bottom: 0;
}

.md-prose code {
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(103, 220, 227, 0.1);
  border: 1px solid rgba(103, 220, 227, 0.2);
  font-size: 0.9em;
  color: #cef9fc;
}

.md-prose pre {
  padding: 14px 16px;
  border-radius: 4px;
  overflow-x: auto;
  background: rgba(5, 7, 16, 0.92);
  border: 1px solid var(--hairline-soft);
}

.md-prose pre code {
  padding: 0;
  border: 0;
  background: transparent;
}

.md-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1.2em 0;
  border: 1px solid var(--hairline);
}

.md-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.md-prose th,
.md-prose td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--hairline-soft);
}

.md-prose th {
  background: rgba(18, 24, 46, 0.92);
  color: var(--gold-bright);
  font-weight: 600;
}

.article-nav {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.article-nav-card {
  padding: 16px 20px;
  border: 1px solid var(--hairline-soft);
  background: rgba(10, 15, 33, 0.65);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.article-nav-card:hover {
  border-color: var(--gold);
}

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
}

/* ---- Minimal Footer ---- */
.site-footer {
  padding: 36px 0;
  border-top: 1px solid var(--hairline-soft);
  background: #04060d;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.footer-copy {
  font-size: 13px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 13px;
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--gold-bright);
}

/* ---- Responsive ---- */
@media (max-width: 1040px) {
  .hero-float-card.left {
    width: 142px;
  }
  .hero-float-card.right {
    width: 134px;
  }
}

@media (max-width: 900px) {
  .nav-links {
    display: none;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .hero-main {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-logo {
    margin-left: auto;
    margin-right: auto;
  }
  .hero-cta {
    justify-content: center;
  }
  .hero-visual {
    min-height: 360px;
  }
  .hero-mascot {
    max-height: 410px;
  }
  .hero-float-card {
    display: none;
  }
  .news-split {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .news-card-anchor {
    width: 220px;
    order: 2;
  }
  .bulletin-row {
    grid-template-columns: 92px auto minmax(0, 1fr);
  }
  .bulletin-arrow {
    display: none;
  }
  .article-nav {
    grid-template-columns: 1fr;
  }
  .article-surface {
    padding: 24px 18px;
  }
}

@media (max-width: 560px) {
  .bulletin-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .bulletin-title span:last-child {
    white-space: normal;
  }
}
