/**
 * ICHINGO Design Tokens
 * -----------------------------------------------------------------------
 * This is the ONLY stylesheet in the entire ICHINGO plugin suite that is
 * allowed to declare raw color/spacing/type values. Every other plugin
 * (guides, destinations, tools, ai-assistant, community, trip-planner...)
 * must consume these custom properties — never hard-code a hex value.
 *
 * FONT HOSTING NOTE (China GFW compliance):
 * Google Fonts (fonts.googleapis.com / fonts.gstatic.com) is blocked in
 * mainland China. Do NOT <link> to Google Fonts. Instead:
 *   1. Download Noto Serif/Sans + JP/KR/SC subsets once at build time.
 *   2. Self-host the .woff2 files under /wp-content/uploads/ichingo-fonts/.
 *   3. This file's @font-face rules point at that self-hosted path via
 *      the ICHINGO_FONTS_URL constant, injected server-side. Falls back
 *      to system fonts (-apple-system, "Segoe UI", "PingFang SC",
 *      "Microsoft YaHei", "Malgun Gothic", "Hiragino Sans") so the site
 *      renders correctly even before fonts finish loading — critical on
 *      throttled mainland connections.
 */

:root {
  color-scheme: light;
}

:root[data-ichingo-theme="dark"],
:root.ichingo-dark {
  color-scheme: dark;
}

/* ---------- System-font fallback stack (loads instantly, zero network) ---------- */
:root {
  --ichingo-font-system:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
    "Malgun Gothic", "Apple SD Gothic Neo",
    "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base element wiring (values injected as CSS vars by PHP) ---------- */
body {
  background: var(--ichingo-bg-canvas);
  color: var(--ichingo-text-ink);
  font-family: var(--ichingo-font-body, var(--ichingo-font-system));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:root.ichingo-dark body,
:root[data-ichingo-theme="dark"] body {
  --ichingo-bg-canvas: var(--ichingo-dark-bg-canvas);
  --ichingo-bg-surface: var(--ichingo-dark-bg-surface);
  --ichingo-bg-surface-alt: var(--ichingo-dark-bg-surface-alt);
  --ichingo-border-subtle: var(--ichingo-dark-border-subtle);
  --ichingo-text-ink: var(--ichingo-dark-text-ink);
  --ichingo-text-muted: var(--ichingo-dark-text-muted);
}

h1, h2, h3, h4, .ichingo-display {
  font-family: var(--ichingo-font-display), var(--ichingo-font-system);
  color: var(--ichingo-text-ink);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

/* RTL auto-mirroring for fa / ar content areas */
[dir="rtl"] { font-family: var(--ichingo-font-fa), var(--ichingo-font-body), var(--ichingo-font-system); }
[dir="rtl"] .ichingo-flex-row { flex-direction: row-reverse; }
[dir="rtl"] .ichingo-icon-lead { transform: scaleX(-1); }

/* Any inline Chinese fragment (street addresses, place names, menu
   items) gets a correctly-weighted CJK glyph instead of silently
   falling back to whatever generic system font the visitor's OS ships —
   these appear constantly throughout guides/tools regardless of which
   UI language is selected. */
:lang(zh), .ichingo-zh-text { font-family: "Noto Sans SC", var(--ichingo-font-body); }

/**
 * Self-hosted display/body/CJK fonts (China-GFW compliance — see file
 * header). Bundled as plugin assets (not a separate uploads-folder step)
 * so they ship with the plugin and need no manual server setup beyond
 * placing the four .woff2 files below at ichingo-core/assets/fonts/:
 *   plus-jakarta-sans-variable.woff2  (Google Fonts: Plus Jakarta Sans, variable, wght 200-800)
 *   outfit-variable.woff2             (Google Fonts: Outfit, variable, wght 300-900)
 *   vazirmatn-variable.woff2          (Google Fonts: Vazirmatn, variable, wght 100-900)
 *   noto-sans-sc-variable.woff2       (Google Fonts: Noto Sans SC, variable, wght 100-900)
 * Until those four files are added, every rule above already falls back
 * cleanly to --ichingo-font-system (zero network requests, instant
 * render) — nothing breaks or shows missing-glyph boxes in the meantime.
 */
/* Typography intentionally uses the system stacks declared above. The old
   @font-face rules pointed to WOFF2 files that were never shipped, causing
   four guaranteed 404 requests while unrelated TTF files occupied ~17.5 MB. */

/* ---------- Shared component primitives (used by every ICHINGO plugin) ---------- */
.ichingo-card {
  background: var(--ichingo-bg-surface);
  border: 1px solid var(--ichingo-border-subtle);
  border-radius: var(--ichingo-radius-lg);
  box-shadow: var(--ichingo-shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease;
}
.ichingo-card:hover { box-shadow: var(--ichingo-shadow-md); }

.ichingo-btn {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  border-radius: var(--ichingo-radius-pill);
  font-weight: 600;
  padding: .75em 1.5em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease;
}
.ichingo-btn:active { transform: scale(0.97); }
.ichingo-btn--primary {
  background: var(--ichingo-color-primary);
  color: #fff;
}
.ichingo-btn--primary:hover { background: var(--ichingo-color-primary-dark); }
.ichingo-btn--ghost {
  background: transparent;
  border-color: var(--ichingo-border-subtle);
  color: var(--ichingo-text-ink);
}
.ichingo-btn--gold {
  background: var(--ichingo-color-accent-gold);
  color: #1a1408;
}

.ichingo-badge {
  display: inline-flex;
  align-items: center;
  font-size: .75rem;
  font-weight: 600;
  padding: .25em .75em;
  border-radius: var(--ichingo-radius-pill);
  background: var(--ichingo-color-primary-tint);
  color: var(--ichingo-color-primary-dark);
}
.ichingo-badge--jade { background: color-mix(in srgb, var(--ichingo-color-jade) 15%, transparent); color: var(--ichingo-color-jade); }
.ichingo-badge--indigo { background: color-mix(in srgb, var(--ichingo-color-indigo) 12%, transparent); color: var(--ichingo-color-indigo); }

.ichingo-container {
  max-width: var(--ichingo-container-max);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

/* "Content over chrome" — editorial section rhythm. Top padding kept
   small and standard (the sticky header already provides visual
   separation) — only the bottom keeps generous breathing room before
   the footer. A large top gap under the header was a reported bug. */
.ichingo-section { padding-block: clamp(1rem, 2.5vw, 1.75rem) clamp(2.5rem, 5vw, 4rem); }

/* Front page only: the long-form ".ichingo-section" padding (up to 6rem)
   left a large empty gap under the sticky header. The homepage's own
   cards (hero banner, trip card) already carry their own internal
   padding, so this wrapper only needs a small breathing gap, not a
   full editorial section rhythm. */
.ichingo-homepage-shell { padding-block: 1.1rem 2.5rem; }

/* Pages whose content already opens with its own hero/header block
   (Emergency Kit, Visa Checker, Preflight Checklist, About, ...) —
   same idea as .ichingo-homepage-shell: no extra top gap is needed
   since the shortcode's own hero already sits flush under the header. */
.ichingo-page-shell { padding-block: 1.1rem 2.5rem; }
.ichingo-prose { max-width: 68ch; line-height: 1.75; }
.ichingo-prose h2 { margin-top: 2.2em; }

/* Subtle East-Asian motif watermark (very low-opacity linework, never competes with content) */
.ichingo-motif-bg {
  background-image: var(--ichingo-motif-svg-url, none);
  background-repeat: no-repeat;
  background-position: right -5% top -5%;
  background-size: 40%;
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .ichingo-animate-in { animation: ichingo-fade-up .5s ease both; }
  @keyframes ichingo-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* ---------- Signature gradients (match the approved prototype exactly) ---------- */
.ichingo-hero-gradient {
  background: linear-gradient(120deg, var(--ichingo-color-primary-dark) 0%, var(--ichingo-color-primary) 55%, #0f172a 100%);
  color: #fff;
}
.ichingo-trip-gradient {
  background: linear-gradient(120deg, var(--ichingo-color-primary-dark) 0%, var(--ichingo-color-primary) 60%, var(--ichingo-color-success) 130%);
  color: #fff;
}
.ichingo-emergency-gradient {
  background: linear-gradient(120deg, #7f1d1d 0%, var(--ichingo-color-danger) 60%, #881337 100%);
  color: #fff;
}

/* Headings inherit --ichingo-text-ink from the global "h1,h2,h3,h4" rule
   above, which wins over the inherited white text on any dark/gradient
   surface (hero banner, trip-mode card, emergency card) because that
   rule sets `color` directly on the element itself. Without this fix,
   every title on a colored card renders in near-black ink and vanishes
   into the background. Force white explicitly wherever these cards are used. */
.ichingo-hero-banner h1, .ichingo-hero-banner h2, .ichingo-hero-banner h3,
.ichingo-hero-gradient h1, .ichingo-hero-gradient h2, .ichingo-hero-gradient h3,
.ichingo-trip-gradient h1, .ichingo-trip-gradient h2, .ichingo-trip-gradient h3,
.ichingo-emergency-gradient h1, .ichingo-emergency-gradient h2, .ichingo-emergency-gradient h3 {
  color: #fff;
}
.ichingo-chip {
  display: inline-flex; align-items: center; gap: .4em;
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: .3em .8em; border-radius: var(--ichingo-radius-pill);
}
.ichingo-chip--gold { background: var(--ichingo-color-accent-gold); color: #1a1408; }
.ichingo-chip--dark { background: rgba(0,0,0,.35); color: #fff; border: 1px solid rgba(255,255,255,.15); }

/* Featured must-have apps quick-link row (homepage) */
.ichingo-featured-apps { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: 1.75rem; }
.ichingo-featured-apps__label { font-size: .75rem; font-weight: 700; color: var(--ichingo-text-muted); text-transform: uppercase; letter-spacing: .03em; margin-inline-end: .3rem; }
.ichingo-featured-apps__pill {
  display: inline-flex; align-items: center; gap: .4em;
  background: var(--ichingo-bg-surface-alt); border: 1px solid var(--ichingo-border-subtle);
  border-radius: var(--ichingo-radius-pill); padding: .45em 1em; font-size: .8rem; font-weight: 700;
  text-decoration: none; color: var(--ichingo-text-ink);
}
.ichingo-featured-apps__pill:hover { background: var(--ichingo-color-primary-tint); border-color: var(--ichingo-color-primary); color: var(--ichingo-color-primary-dark); }

/* Homepage quick-link cards (Alipay&WeChat / Hotel Cards / 12306) */
.ichingo-quick-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.1rem; }
.ichingo-quick-card { display: block; padding: 1.25rem; text-decoration: none; color: inherit; }
.ichingo-quick-card__icon { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: var(--ichingo-radius-md); background: var(--ichingo-color-primary-tint); font-size: 1.2rem; margin-bottom: .6rem; }
.ichingo-quick-card h3 { font-size: .95rem; margin: 0 0 .3rem; }
.ichingo-quick-card p { font-size: .78rem; color: var(--ichingo-text-muted); margin: 0; line-height: 1.5; }
.ichingo-quick-card:hover { border-color: var(--ichingo-color-primary); }

.ichingo-homepage-links { display: flex; flex-wrap: wrap; gap: .75rem; }

/* Step-flow guidance UI (Trip Mode / checklists / wizards) */
.ichingo-step-track { display: flex; align-items: center; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; }
.ichingo-step-dot {
  width: 1.75rem; height: 1.75rem; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 800; background: var(--ichingo-bg-surface-alt); color: var(--ichingo-text-muted);
  border: 2px solid var(--ichingo-border-subtle);
}
.ichingo-step-dot.is-done { background: var(--ichingo-color-success); border-color: var(--ichingo-color-success); color: #fff; }
.ichingo-step-dot.is-current { background: var(--ichingo-color-accent-gold); border-color: var(--ichingo-color-accent-gold); color: #1a1408; }
.ichingo-step-line { flex: 1; height: 2px; background: var(--ichingo-border-subtle); min-width: 1.5rem; }
.ichingo-step-line.is-done { background: var(--ichingo-color-success); }

/* FAQ accordion (native <details>/<summary> — no JS needed) */
.ichingo-faq { display: flex; flex-direction: column; gap: .75rem; margin: 1.25rem 0; }
.ichingo-faq-item {
  border: 1px solid var(--ichingo-border-subtle); border-radius: var(--ichingo-radius-md);
  background: var(--ichingo-bg-surface); overflow: hidden;
}
.ichingo-faq-item summary {
  cursor: pointer; padding: 1rem 1.25rem; font-weight: 700; font-size: .92rem;
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.ichingo-faq-item summary::-webkit-details-marker { display: none; }
.ichingo-faq-item summary::after {
  content: '+'; font-size: 1.3rem; line-height: 1; color: var(--ichingo-text-muted);
  transition: transform .2s ease; flex-shrink: 0;
}
.ichingo-faq-item[open] summary::after { transform: rotate(45deg); }
.ichingo-faq-item p { padding: 0 1.25rem 1.1rem; margin: 0; color: var(--ichingo-text-muted); font-size: .88rem; line-height: 1.65; }

/* Simple numbered/lettered info cards for About/Contact style pages */
.ichingo-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.ichingo-stat-card { padding: 1.25rem; text-align: center; }
.ichingo-stat-card__num { font-family: var(--ichingo-font-display), var(--ichingo-font-system); font-size: 1.8rem; font-weight: 800; color: var(--ichingo-color-primary); line-height: 1.1; }
.ichingo-stat-card__label { font-size: .78rem; color: var(--ichingo-text-muted); margin-top: .3rem; }

/* Keyboard and motion preferences apply across every ICHINGO module. */
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible {
  outline: 3px solid var(--ichingo-color-accent-gold);
  outline-offset: 3px;
}
@media (pointer: coarse) {
  :where(button,input,select,textarea) { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
