/* ==========================================================================
   杨帆云 / yangfancloud.my — 京都雨后小巷风 design system
   ========================================================================== */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.visually-hidden:focus {
  position: fixed; top: 10px; left: 10px; width: auto; height: auto;
  z-index: 100; background: #fff; padding: 10px 16px; border-radius: 8px; clip: auto;
}

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, h4, p, ul, ol, li, figure, blockquote, dl, dd { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
img, picture, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }

/* ---- design tokens ---- */
:root {
  --bg: #F6F8F7;
  --primary: #607D8B;
  --primary-dark: #4d6672;
  --secondary: #CFD8DC;
  --text: #37474F;
  --text-strong: #263238;
  --text-weak: #78909C;
  --card-bg: rgba(255,255,255,0.72);
  --card-bg-solid: #ffffff;
  --border: rgba(96,125,139,0.16);
  --shadow-sm: 0 2px 10px rgba(38,50,56,0.05);
  --shadow-md: 0 8px 28px rgba(38,50,56,0.08);
  --shadow-lg: 0 16px 40px rgba(38,50,56,0.12);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --accent-warm: #C9A97A;
  --danger: #B0645A;
  --ok: #5C8A72;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --maxw: 1160px;
  --content-w: 780px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

main { flex: 1; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

h1, h2, h3, h4 { color: var(--text-strong); font-weight: 700; line-height: 1.35; letter-spacing: 0.01em; }
h1 { font-size: clamp(28px, 4vw, 40px); }
h2 { font-size: clamp(22px, 3vw, 28px); margin-bottom: 6px; }
h3 { font-size: 19px; }
p { color: var(--text); }
.lead { font-size: 18px; color: var(--text-weak); }

/* ---- rain texture backdrop (subtle, decorative) ---- */
.rain-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.rain-bg::before {
  content: "";
  position: absolute;
  inset: -10% -10% -10% -10%;
  background:
    radial-gradient(ellipse 60% 40% at 15% 10%, rgba(207,216,220,0.55), transparent 60%),
    radial-gradient(ellipse 50% 35% at 90% 0%, rgba(96,125,139,0.12), transparent 60%),
    linear-gradient(180deg, #EEF2F1 0%, #F6F8F7 55%, #F6F8F7 100%);
}
.rain-bg .drop {
  position: absolute;
  width: 1px;
  height: 60px;
  background: linear-gradient(180deg, transparent, rgba(96,125,139,0.28));
  animation: fall 2.4s linear infinite;
}
@keyframes fall {
  0% { transform: translateY(-80px); opacity: 0; }
  15% { opacity: 0.7; }
  100% { transform: translateY(220px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .rain-bg .drop { animation: none; opacity: 0.15; }
}
.rain-bg .eaves {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(180deg, transparent, rgba(96,125,139,0.06));
}

/* ---- header / nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246,248,247,0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 19px;
  color: var(--text-strong);
}
.brand .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.brand .mark svg { width: 16px; height: 16px; }

.main-nav { display: flex; align-items: center; gap: 26px; }
.main-nav a {
  font-size: 14.5px;
  color: var(--text);
  position: relative;
  padding: 6px 0;
  white-space: nowrap;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--primary-dark); }
.main-nav a[aria-current="page"]::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--primary);
  border-radius: 2px;
}
.header-cta { display: flex; align-items: center; gap: 12px; }
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  width: 38px; height: 38px; align-items: center; justify-content: center;
}
.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 8px 20px 16px;
  border-top: 1px solid var(--border);
  background: rgba(246,248,247,0.98);
}
.mobile-nav a { padding: 10px 4px; font-size: 15px; border-bottom: 1px solid rgba(96,125,139,0.08); }
.mobile-nav.open { display: flex; }

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  transition: transform 220ms ease, box-shadow 220ms ease, background 220ms ease;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--card-bg-solid); color: var(--text-strong); border-color: var(--border); }
.btn-secondary:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--primary); }
.btn-ghost { color: var(--primary-dark); padding: 8px 4px; }
.btn-ghost:hover { text-decoration: underline; }
.btn-sm { padding: 9px 16px; font-size: 13.5px; }

/* ---- cards ---- */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: rgba(96,125,139,0.32); }
.card-pad { padding: 26px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.tag {
  display: inline-block;
  font-size: 12.5px;
  color: var(--primary-dark);
  background: rgba(96,125,139,0.1);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 600;
}
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- hero ---- */
.hero {
  position: relative;
  padding: 76px 0 56px;
  overflow: hidden;
}
.hero .container { position: relative; z-index: 1; }
.hero-eyebrow { color: var(--primary-dark); font-weight: 700; letter-spacing: 0.08em; font-size: 13px; text-transform: uppercase; }
.hero h1 { margin-top: 14px; }
.hero .sub { margin-top: 8px; font-size: 20px; color: var(--text-strong); font-weight: 500; }
.hero p.lead { margin-top: 18px; max-width: 640px; }
.hero-cta { display: flex; gap: 14px; margin-top: 30px; flex-wrap: wrap; }
.hero-tags { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 40px; }

/* ---- quick answer / GEO box ---- */
.answer-box {
  background: var(--card-bg-solid);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 24px 26px;
  margin: 28px 0;
  box-shadow: var(--shadow-sm);
}
.answer-box .label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.answer-box p { color: var(--text-strong); font-size: 16.5px; }
.conclusions { margin-top: 16px; display: grid; gap: 8px; }
.conclusions li { display: flex; gap: 10px; font-size: 15px; color: var(--text); }
.conclusions li::before { content: "—"; color: var(--primary); flex-shrink: 0; }

/* ---- meta row ---- */
.meta-row {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: 13.5px; color: var(--text-weak);
  padding-bottom: 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ---- breadcrumb ---- */
.breadcrumb { font-size: 13.5px; color: var(--text-weak); margin-bottom: 18px; }
.breadcrumb a { color: var(--text-weak); }
.breadcrumb a:hover { color: var(--primary-dark); }
.breadcrumb .sep { margin: 0 6px; color: var(--secondary); }

/* ---- article layout ---- */
.article-shell {
  padding: 40px 0 80px;
  position: relative;
}
.article-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--content-w)) 280px;
  gap: 48px;
  align-items: start;
}
.article-body { min-width: 0; max-width: var(--content-w); }
.article-body h2 { margin-top: 44px; margin-bottom: 14px; scroll-margin-top: 90px; }
.article-body h3 { margin-top: 28px; margin-bottom: 10px; scroll-margin-top: 90px; }
.article-body p { margin-bottom: 16px; font-size: 17px; }
.article-body ul, .article-body ol { margin: 0 0 16px 1.3em; }
.article-body li { margin-bottom: 6px; font-size: 16.5px; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body strong { color: var(--text-strong); }
.article-body a:not(.btn) { color: var(--primary-dark); text-decoration: underline; text-underline-offset: 3px; }
.article-body table { display: block; overflow-x: auto; max-width: 100%; margin: 20px 0; font-size: 15px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.article-body table thead, .article-body table tbody { display: table; width: 100%; table-layout: auto; }
.article-body th, .article-body td { padding: 11px 15px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.article-body th { background: rgba(96,125,139,0.08); color: var(--text-strong); font-weight: 700; }
.article-body tr:last-child td { border-bottom: none; }
.article-body blockquote {
  border-left: 3px solid var(--primary);
  padding: 4px 18px;
  color: var(--text-weak);
  margin: 20px 0;
  font-size: 15.5px;
}

.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); margin: 20px 0; }
.table-wrap table { min-width: 480px; }
.table-wrap th, .table-wrap td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.table-wrap th { background: rgba(96,125,139,0.08); color: var(--text-strong); font-weight: 700; white-space: nowrap; }
.table-wrap tr:last-child td { border-bottom: none; }

/* ---- TOC ---- */
.toc {
  position: sticky;
  top: 90px;
}
.toc-title { font-size: 13px; font-weight: 700; color: var(--text-strong); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc li { margin-bottom: 2px; }
.toc a {
  display: block;
  font-size: 13.5px;
  color: var(--text-weak);
  padding: 6px 0 6px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
}
.toc a:hover { color: var(--primary-dark); border-left-color: var(--secondary); }

/* ---- sidebar ---- */
.sidebar { display: flex; flex-direction: column; gap: 20px; }
.side-card { padding: 20px; }
.side-card h4 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-strong); margin-bottom: 14px; }
.side-list { display: flex; flex-direction: column; gap: 10px; }
.side-list a { font-size: 14.5px; color: var(--text); line-height: 1.5; }
.side-list a:hover { color: var(--primary-dark); }
.side-note { font-size: 12.5px; color: var(--text-weak); line-height: 1.6; }

/* ---- FAQ ---- */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg-solid);
  margin-bottom: 12px;
  overflow: hidden;
}
.faq-q {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  font-weight: 600;
  font-size: 15.5px;
  color: var(--text-strong);
  background: none; border: none; text-align: left;
}
.faq-q .icon { flex-shrink: 0; transition: transform 200ms ease; color: var(--primary); }
.faq-item[open] .faq-q .icon { transform: rotate(45deg); }
.faq-a { padding: 0 20px 18px; font-size: 15px; color: var(--text); }
.faq-a p:first-child { font-weight: 600; color: var(--text-strong); margin-bottom: 8px; }

/* ---- pagination / related ---- */
.post-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 48px;
}
.post-nav a {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg-solid);
}
.post-nav .dir { font-size: 12px; color: var(--text-weak); margin-bottom: 4px; }
.post-nav .ttl { font-size: 14.5px; font-weight: 600; color: var(--text-strong); }
.post-nav .next { text-align: right; grid-column: 2; }

.related-grid { margin-top: 16px; }
.related-grid a { display: block; padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.related-grid a:last-child { border-bottom: none; }

.source-note {
  margin-top: 40px;
  padding: 18px 20px;
  background: rgba(96,125,139,0.06);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-weak);
  line-height: 1.7;
}

.back-to-top {
  position: fixed;
  bottom: 26px; right: 26px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--card-bg-solid);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
  z-index: 40;
}
.back-to-top.show { opacity: 1; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-3px); }

/* ---- sections (home) ---- */
.section { padding: 64px 0; }
.section-head { max-width: 640px; margin-bottom: 34px; }
.section-eyebrow { font-size: 13px; font-weight: 700; color: var(--primary-dark); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.section-alt { background: rgba(207,216,220,0.28); }

.feature-card { padding: 26px; display: flex; flex-direction: column; gap: 10px; }
.feature-card .icon-wrap {
  width: 42px; height: 42px; border-radius: 12px;
  background: rgba(96,125,139,0.1);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-dark);
  margin-bottom: 6px;
}
.feature-card h3 { font-size: 17.5px; }
.feature-card p { font-size: 14.5px; color: var(--text-weak); }
.feature-card .more { margin-top: auto; font-size: 13.5px; font-weight: 600; color: var(--primary-dark); }

.post-card { padding: 22px; display: flex; flex-direction: column; gap: 10px; height: 100%; }
.post-card .cat { font-size: 12px; font-weight: 700; color: var(--primary-dark); text-transform: uppercase; letter-spacing: 0.04em; }
.post-card h3 { font-size: 17px; }
.post-card p { font-size: 14px; color: var(--text-weak); flex: 1; }
.post-card .foot { font-size: 12.5px; color: var(--text-weak); display: flex; justify-content: space-between; margin-top: 6px; }

.content-layout { display: grid; grid-template-columns: 1fr 320px; gap: 40px; align-items: start; }

.cta-band {
  border-radius: var(--radius-lg);
  padding: 48px;
  background: linear-gradient(135deg, rgba(96,125,139,0.94), rgba(77,102,114,0.96));
  color: #fff;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255,255,255,0.82); max-width: 560px; margin: 12px auto 0; }
.cta-band .hero-cta { justify-content: center; margin-top: 26px; }
.cta-band .btn-secondary { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.3); }
.cta-band .btn-secondary:hover { background: rgba(255,255,255,0.22); }

.risk-note {
  border: 1px solid rgba(176,100,90,0.3);
  background: rgba(176,100,90,0.06);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin: 20px 0;
  font-size: 14.5px;
}
.risk-note .label { color: var(--danger); font-weight: 700; font-size: 13px; text-transform: uppercase; margin-bottom: 6px; letter-spacing: 0.04em; }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--border); background: rgba(255,255,255,0.5); padding: 56px 0 28px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 36px; }
.footer-col h4 { font-size: 13.5px; color: var(--text-strong); margin-bottom: 14px; }
.footer-col ul { display: flex; flex-direction: column; gap: 10px; }
.footer-col a { font-size: 14px; color: var(--text-weak); }
.footer-col a:hover { color: var(--primary-dark); }
.footer-brand p { font-size: 13.5px; color: var(--text-weak); margin-top: 10px; max-width: 300px; }
.footer-bottom {
  margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-weak); line-height: 1.7;
}
.footer-bottom .disclaimer { max-width: 900px; margin-bottom: 10px; }

/* ---- misc pages (about/legal) rain-heavy styling ---- */
.zen-page .hero { padding: 90px 0 70px; }
.zen-page .card { background: rgba(255,255,255,0.8); }
.window-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  background: var(--card-bg);
  backdrop-filter: blur(8px);
}

/* ---- 404 ---- */
.error-page { min-height: 60vh; display: flex; align-items: center; }
.error-page .container { text-align: center; }
.error-code { font-size: 96px; font-weight: 800; color: var(--secondary); line-height: 1; }

/* ---- reveal on scroll ---- */
[data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity 480ms ease, transform 480ms ease; }
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

/* ---- responsive ---- */
@media (max-width: 980px) {
  .article-grid { grid-template-columns: 1fr; }
  .toc { display: none; }
  .content-layout { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .main-nav { display: none; }
  .nav-toggle { display: flex; }
  .hero { padding: 52px 0 40px; }
  .hero-cta .btn { width: 100%; }
  .hero-cta { flex-direction: column; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; grid-column: 1; }
  .cta-band { padding: 34px 22px; }
  .section { padding: 44px 0; }
  h1 { font-size: 28px; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
}
