/* ═══════════════════════════════════════════════════════════
   ChineseFortuneTools.com — Design System v1.0
   Theme: Ink & Gold (墨金) — Dark, minimal, premium
   ═══════════════════════════════════════════════════════════ */

/* ─── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600&family=Noto+Serif+SC:wght@400;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-primary:    #0F0F14;
  --bg-card:       #1A1A26;
  --bg-hover:      #22222F;
  --bg-input:      #0F0F14;

  /* Text */
  --text-primary:  #F2EDE4;
  --text-secondary:#9B97A0;
  --text-muted:    #5C5A63;

  /* Borders */
  --border:        #2E2E3A;
  --border-hover:  #C9A84C;

  /* Accent — Gold */
  --gold:          #C9A84C;
  --gold-dim:      #8B6F2E;
  --gold-glow:     rgba(201,168,76,0.15);

  /* Accent — Vermilion */
  --vermilion:     #C0392B;
  --vermilion-dim: rgba(192,57,43,0.15);

  /* Accent — Jade */
  --jade:          #5F9EA0;
  --jade-dim:      rgba(95,158,160,0.15);

  /* Five Elements */
  --wood:   #5B7B3A;
  --fire:   #C0392B;
  --earth:  #B8860B;
  --metal:  #A8A8A8;
  --water:  #1A4378;

  /* Typography */
  --font-serif:  'Playfair Display', Georgia, serif;
  --font-sans:   'Inter', system-ui, -apple-system, sans-serif;
  --font-cn:     'Noto Serif SC', serif;
  --font-mono:   'JetBrains Mono', monospace;

  /* Spacing */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;

  /* Transitions */
  --transition: all 0.25s ease-out;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle ink texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(201,168,76,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(95,158,160,0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 600; }
h3 { font-size: clamp(1.125rem, 2vw, 1.5rem); font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; font-family: var(--font-sans); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); }

p { color: var(--text-primary); margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--gold); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--text-primary); }

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.text-gold { color: var(--gold); }
.text-center { text-align: center; }

/* Chinese character display */
.cn-char {
  font-family: var(--font-cn);
  color: var(--gold);
}

/* Overline label */
.overline {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* ─── Layout ────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.container--narrow { max-width: 720px; }
.container--wide   { max-width: 1280px; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
}

/* ─── Navigation ────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,15,20,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.nav__logo {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.nav__logo span { color: var(--gold); }

.nav__links {
  display: flex;
  gap: 32px;
  list-style: none;
}

.nav__links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.nav__links a:hover { color: var(--text-primary); }

.nav__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
}

.nav__hamburger span {
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--text-secondary);
  transition: var(--transition);
}

@media (max-width: 768px) {
  .nav__links { display: none; }
  .nav__hamburger { display: flex; }
  .nav__links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    padding: 24px;
    border-bottom: 1px solid var(--border);
    gap: 24px;
  }
}

/* ─── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px var(--gold-glow);
}

.card--flat:hover { transform: none; }

.card__label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  white-space: nowrap;
  text-decoration: none;
}

/* Gold outline — primary CTA */
.btn--primary {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
}
.btn--primary:hover {
  background: var(--gold);
  color: #0F0F14;
}

/* Filled gold */
.btn--gold {
  background: var(--gold);
  border: 1px solid var(--gold);
  color: #0F0F14;
  font-weight: 600;
}
.btn--gold:hover {
  background: #B8943A;
  border-color: #B8943A;
  color: #0F0F14;
}

/* Ghost */
.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn--ghost:hover {
  border-color: var(--gold);
  color: var(--text-primary);
}

.btn--lg { padding: 16px 36px; font-size: 1rem; }
.btn--full { width: 100%; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Form Elements ─────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

input::placeholder { color: var(--text-muted); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239B97A0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

/* Date inputs — 3 selects side by side */
.date-input-group {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .date-input-group { grid-template-columns: 1fr 1fr; }
  .date-input-group select:first-child { grid-column: 1 / -1; }
}

/* ─── Divider ───────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 32px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Gold accent bar */
.accent-bar {
  width: 48px;
  height: 1px;
  background: var(--gold);
  margin: 16px 0;
}

.accent-bar--center { margin: 16px auto; }

/* ─── Tags / Badges ─────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.tag--gold     { background: var(--gold-glow);    color: var(--gold);     border: 1px solid rgba(201,168,76,0.3); }
.tag--jade     { background: var(--jade-dim);      color: var(--jade);     border: 1px solid rgba(95,158,160,0.3); }
.tag--vermilion{ background: var(--vermilion-dim); color: var(--vermilion);border: 1px solid rgba(192,57,43,0.3); }
.tag--muted    { background: rgba(155,151,160,0.1);color: var(--text-secondary); border: 1px solid var(--border); }

/* ─── Element Colors ────────────────────────────────────────── */
.element-wood   { color: var(--wood); }
.element-fire   { color: var(--fire); }
.element-earth  { color: var(--earth); }
.element-metal  { color: var(--metal); }
.element-water  { color: var(--water); }

.element-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.element-badge.wood   { background: rgba(91,123,58,0.15);  border: 1px solid rgba(91,123,58,0.4);  color: var(--wood); }
.element-badge.fire   { background: rgba(192,57,43,0.15);  border: 1px solid rgba(192,57,43,0.4);  color: var(--fire); }
.element-badge.earth  { background: rgba(184,134,11,0.15); border: 1px solid rgba(184,134,11,0.4); color: var(--earth);}
.element-badge.metal  { background: rgba(168,168,168,0.1); border: 1px solid rgba(168,168,168,0.3);color: var(--metal);}
.element-badge.water  { background: rgba(26,67,120,0.2);   border: 1px solid rgba(26,67,120,0.5);  color: #4A7FBF; }

/* ─── Hero Section ──────────────────────────────────────────── */
.hero {
  min-height: 80vh;
  display: flex;
  align-items: center;
  padding: 80px 0 60px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(201,168,76,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero__content { text-align: center; position: relative; z-index: 1; }

.hero__eyebrow {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 24px;
}

.hero__title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.hero__subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto 40px;
  line-height: 1.65;
}

/* ─── Tool Grid ─────────────────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  text-align: center;
  text-decoration: none;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.tool-card:hover {
  border-color: var(--gold);
  background: rgba(201,168,76,0.04);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.tool-card__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  line-height: 1;
}

.tool-card__name {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.tool-card__desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

@media (max-width: 768px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .tool-card { padding: 18px 14px; }
}

/* ─── Result Cards ──────────────────────────────────────────── */
.result-section {
  animation: fadeUp 0.4s ease-out;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}

.result-hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.result-animal-icon {
  font-size: 5rem;
  line-height: 1;
  margin-bottom: 16px;
  display: block;
}

.result-ganzhi {
  font-family: var(--font-cn);
  font-size: 2.5rem;
  color: var(--gold);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.result-ganzhi-py {
  font-size: 0.875rem;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  margin-bottom: 20px;
}

/* Info pills row */
.result-pills {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* Data grid for details */
.data-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.data-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.data-item__label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.data-item__value {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.data-item__sub {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

@media (max-width: 600px) {
  .result-hero-card { padding: 28px 20px; }
  .data-grid { grid-template-columns: 1fr; }
}

/* ─── Personality Section ───────────────────────────────────── */
.personality-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
}

.trait-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.trait-list li {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.trait-list--strength li {
  background: var(--jade-dim);
  color: var(--jade);
  border: 1px solid rgba(95,158,160,0.25);
}

.trait-list--challenge li {
  background: rgba(155,151,160,0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Compatibility pills */
.compat-group { margin-bottom: 16px; }
.compat-label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ─── Loading Spinner ───────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Alert / Notice ────────────────────────────────────────── */
.notice {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.5;
  border-left: 3px solid;
  margin-bottom: 20px;
}

.notice--info {
  background: var(--gold-glow);
  border-color: var(--gold);
  color: var(--text-secondary);
}

.notice--boundary {
  background: rgba(192,57,43,0.08);
  border-color: var(--vermilion);
  color: var(--text-secondary);
}

/* ─── Footer ────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
  margin-top: 80px;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer__brand p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 12px;
}

.footer__col h5 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-family: var(--font-sans);
}

.footer__col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer__col a {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

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

.footer__bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer__disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 600px;
}

.footer__copy {
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer__bottom { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .footer__grid { grid-template-columns: 1fr; }
}

/* ─── Section Spacing ───────────────────────────────────────── */
.section { padding: 72px 0; }
.section--sm { padding: 48px 0; }
.section__header { margin-bottom: 48px; }

/* ─── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb span { color: var(--text-secondary); }

/* ─── Tooltip ───────────────────────────────────────────────── */
[data-tooltip] { position: relative; cursor: help; border-bottom: 1px dashed var(--border); }

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  width: max-content;
  max-width: 240px;
  text-align: center;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 50;
  font-family: var(--font-sans);
  font-weight: 400;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ─── Utilities ─────────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mb-48 { margin-bottom: 48px; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ─── GA tag placeholder (inserted by includes/header.php) ──── */
/* G-DBR2PMLR61 */
