/* ============================================================
   Homepage — 视差滚动 (layout) × 田园核风 (visuals)
   index.html only; other pages keep style.css.
   ============================================================ */

:root {
  /* colors — pastoral */
  --color-meadow: #5a8f5a;
  --color-cloth: #faf6f0;
  --color-wheat: #f5d75f;
  --color-timber: #8b7355;
  --color-wild-rose: #d4a0a0;
  --color-sprout: #7ff77e;

  --ink: #3d3a34;
  --muted: #7a7266;

  /* typography */
  --font-serif: 'Lora', Georgia, 'Songti SC', 'SimSun', serif;

  --text-display: clamp(30px, 6vw, 48px);
  --text-heading: clamp(24px, 4vw, 36px);
  --text-subheading: clamp(20px, 2.6vw, 28px);
  --text-body-lg: 21px;
  --text-body: 17px;
  --text-label: 15px;

  /* spacing & layout */
  --page-max: 1120px;
  --card-pad: 48px;

  /* radii */
  --radius-card: 24px;
  --radius-btn: 999px;
  --radius-input: 16px;

  /* elevation (pastoral soft) */
  --shadow-soft: 0 4px 10px rgba(90, 143, 90, .20);
  --shadow-soft-hover: 0 8px 20px rgba(90, 143, 90, .30);
  --shadow-pressed: 0 2px 6px rgba(90, 143, 90, .20);
  --shadow-card: 0 24px 60px rgba(90, 143, 90, .18);
  --shadow-card-hover: 0 32px 80px rgba(90, 143, 90, .24);

  /* linen texture (SVG noise) */
  --linen: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");

  /* floral sprig (identity marker) */
  --sprig: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M8 26 C12 20 16 12 22 6' stroke='%235a8f5a' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3Cellipse cx='12' cy='18' rx='4.6' ry='2.4' transform='rotate(-28 12 18)' fill='%235a8f5a' opacity='.45'/%3E%3Cellipse cx='18' cy='12' rx='4' ry='2.1' transform='rotate(24 18 12)' fill='%23d4a0a0' opacity='.6'/%3E%3Ccircle cx='24' cy='5' r='2' fill='%23f5d75f'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-serif);
  background: var(--color-cloth) var(--linen) repeat;
  color: var(--ink);
  font-size: var(--text-body);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--color-meadow); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; letter-spacing: .01em; }

::selection { background: rgba(90, 143, 90, .25); }

/* focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--color-meadow);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* ---------------- header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 80;
  background: rgba(250, 246, 240, .86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px dashed rgba(90, 143, 90, .28);
}
.site-header .container {
  display: flex; align-items: center; gap: 24px; min-height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 20px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 32px; height: 32px; border-radius: 999px; flex: none;
  background: rgba(90, 143, 90, .14);
  display: inline-flex; align-items: center; justify-content: center;
}
.brand .logo svg { width: 20px; height: 20px; }
.nav { display: flex; gap: 6px; margin-left: 8px; flex-wrap: wrap; }
.nav a {
  padding: 8px 16px; border-radius: 999px;
  color: var(--ink); font-weight: 600; font-size: 15px;
}
.nav a:hover { background: rgba(90, 143, 90, .12); text-decoration: none; }
.nav a.active { background: var(--color-meadow); color: var(--color-cloth); }

/* ---------------- parallax scene ---------------- */
.scene {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background-size: cover; background-position: center;
  background-attachment: fixed;
  scroll-margin-top: 64px;
  overflow: hidden;
}

/* light "veil" layer — keeps readability, follows parallax layering */
.scene-veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(250, 246, 240, .72) 0%,
    rgba(250, 246, 240, .35) 45%,
    rgba(250, 246, 240, .15) 100%);
  pointer-events: none;
}

.scene-content {
  position: relative;
  max-width: var(--page-max);
  width: 100%;
  margin: 0 auto;
  padding: 96px 32px;
  z-index: 2;
}

/* background scenes (CSS gradients — no external imagery) */
.hero {
  background-image:
    radial-gradient(900px 420px at 78% 16%, rgba(245, 215, 95, .5), transparent 62%),
    radial-gradient(760px 380px at 16% 48%, rgba(212, 160, 160, .3), transparent 64%),
    linear-gradient(180deg, #fdf9ee 0%, #fbf4e8 38%, #e7e8c8 72%, #b5c795 100%);
}
.software {
  background-image:
    radial-gradient(720px 340px at 82% 18%, rgba(90, 143, 90, .28), transparent 60%),
    linear-gradient(180deg, #f6f0e0 0%, #eef0d8 42%, #cdd6a8 78%, #a3b184 100%);
}
.games {
  background-image:
    radial-gradient(700px 330px at 80% 20%, rgba(212, 160, 160, .34), transparent 62%),
    radial-gradient(640px 300px at 16% 58%, rgba(245, 215, 95, .34), transparent 60%),
    linear-gradient(180deg, #fdf6e6 0%, #f7e9c8 46%, #e3cfae 80%, #bda98c 100%);
}
.tutorials {
  background-image:
    radial-gradient(720px 340px at 20% 22%, rgba(90, 143, 90, .3), transparent 60%),
    linear-gradient(180deg, #f2efdf 0%, #dcdcc0 46%, #b7c49d 84%, #8ea276 100%);
}

/* ---------------- transition bands (缝合渐变带) ---------------- */
.transition-band { height: 160px; }
.band-1 { background: linear-gradient(180deg, #b5c795 0%, #e6e7c8 45%, #f6f0e0 100%); }
.band-2 { background: linear-gradient(180deg, #cdd6a8 0%, #f0e4c4 45%, #fdf6e6 100%); }
.band-3 { background: linear-gradient(180deg, #e3cfae 0%, #dfe2c4 50%, #f2efdf 100%); }

/* ---------------- content card ---------------- */
.content-card {
  position: relative;
  background: rgba(255, 253, 248, .9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(90, 143, 90, .14);
  border-radius: var(--radius-card);
  padding: var(--card-pad);
  box-shadow: var(--shadow-card);
}
.content-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-4px); }

/* floral sprigs on card corners (identity marker) */
.content-card::before {
  content: ''; position: absolute; top: -12px; left: -12px;
  width: 42px; height: 42px;
  background: var(--sprig) center/contain no-repeat;
  transform: rotate(-8deg);
  pointer-events: none;
}
.content-card::after {
  content: ''; position: absolute; bottom: 22px; right: 26px;
  width: 18px; height: 18px; border-radius: 999px;
  background: rgba(245, 215, 95, .5);
  pointer-events: none;
}

/* ---------------- hero ---------------- */
.hero-card { max-width: 760px; margin: 0 auto; text-align: center; }
.eyebrow {
  margin: 0 0 10px;
  font-size: var(--text-label); font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--color-meadow);
}
.hero-card h1 { font-size: var(--text-display); line-height: 1.2; margin: 0 0 14px; }
.hero-text { font-size: var(--text-body-lg); line-height: 1.75; color: var(--muted); max-width: 560px; margin: 0 auto 26px; }

/* search — fabric field + meadow button */
.search-bar {
  max-width: 560px; margin: 0 auto;
  display: flex; gap: 10px;
}
.search-bar input {
  flex: 1;
  background: #fffdf8;
  border: 1px solid rgba(139, 115, 85, .28);
  border-radius: var(--radius-input);
  padding: 12px 18px;
  font-size: var(--text-body);
  font-family: inherit; color: var(--ink);
  outline: none;
  transition: border-color .3s ease, box-shadow .3s ease;
}
.search-bar input::placeholder { color: rgba(139, 115, 85, .55); }
.search-bar input:focus {
  border-color: var(--color-meadow);
  box-shadow: 0 0 0 3px rgba(90, 143, 90, .15);
}

/* ---------------- buttons (meadow button) ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer;
  background: var(--color-meadow); color: var(--color-cloth);
  border-radius: var(--radius-btn);
  padding: 12px 32px;
  font-family: inherit; font-size: var(--text-label); font-weight: 600;
  box-shadow: var(--shadow-soft);
  transition: transform .5s ease-in-out, box-shadow .5s ease-in-out, background .5s ease-in-out;
}
.btn:hover { transform: translateY(-2px) rotate(.8deg); box-shadow: var(--shadow-soft-hover); text-decoration: none; }
.btn:active { transform: rotate(0) scale(.97); box-shadow: var(--shadow-pressed); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-sm { padding: 8px 18px; font-size: 14px; }

/* ---------------- section head ---------------- */
.section-head {
  display: flex; align-items: baseline; gap: 14px;
  margin-bottom: 22px; position: relative;
}
.section-head .sprig { flex: none; width: 26px; height: 26px; align-self: center; transform: rotate(-8deg); }
.section-head h2 { font-size: var(--text-heading); margin: 0; color: var(--ink); }
.section-head .count-badge {
  font-size: 13px; color: var(--color-timber);
  background: rgba(90, 143, 90, .12);
  padding: 3px 12px; border-radius: 999px;
}
.section-head .more { margin-left: auto; font-size: 15px; font-weight: 600; color: var(--color-meadow); white-space: nowrap; }
.section-head .more:hover { text-decoration: underline; }

/* stitched rule under section heads */
.section-head::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -12px;
  border-bottom: 2px dashed rgba(90, 143, 90, .3);
}

/* ---------------- category chips (fabric pills) ---------------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  background: rgba(255, 253, 248, .85);
  border: 1px solid rgba(139, 115, 85, .25);
  border-radius: 999px;
  cursor: pointer;
  font-size: 15px; font-family: inherit; color: var(--ink);
  transition: border-color .3s ease, background .3s ease, transform .3s ease, box-shadow .3s ease;
  user-select: none;
}
.chip:hover { border-color: var(--color-meadow); transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.chip.active { background: var(--color-meadow); border-color: var(--color-meadow); color: var(--color-cloth); }

/* ---------------- item cards (linen card) ---------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; margin-top: 20px; }
.card {
  background: linear-gradient(180deg, #fffdf8, #fcf6ec);
  border: 1px solid rgba(90, 143, 90, .16);
  border-radius: var(--radius-card);
  padding: 22px;
  box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 12px;
  transition: transform .5s ease-in-out, box-shadow .5s ease-in-out;
}
.card:hover { transform: translateY(-4px) rotate(.6deg); box-shadow: var(--shadow-soft-hover); }
.card .card-top { display: flex; gap: 12px; align-items: flex-start; }

.icon-box {
  width: 52px; height: 52px; border-radius: 16px; flex: none;
  background: rgba(90, 143, 90, .12);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.icon-box img { width: 100%; height: 100%; object-fit: cover; border-radius: 16px; }

.card .title { font-size: 18px; font-weight: 600; margin: 0; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.card .desc { font-size: 14px; line-height: 1.65; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 46px; letter-spacing: .01em; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.card .actions { margin-top: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* game cover */
.cover-box {
  width: 100%; height: 150px; border-radius: 16px; overflow: hidden;
  background: #dfe3c8; position: relative; display: block;
}
.cover-box img { width: 100%; height: 100%; object-fit: cover; }
.cover-box .play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(61, 58, 52, .3);
  color: #fffdf8; font-size: 32px;
  opacity: 0; transition: opacity .4s ease;
}
.cover-box:hover .play-overlay, .cover-box:focus-visible .play-overlay { opacity: 1; }

/* tutorial list */
#tutorialList { display: grid; gap: 16px; margin-top: 20px; }
#tutorialList .card { flex-direction: row; align-items: center; gap: 18px; padding: 22px 26px; }

/* ---------------- scroll cue ---------------- */
.scroll-cue {
  position: absolute; left: 50%; bottom: 28px;
  transform: translateX(-50%);
  text-align: center; z-index: 3;
}
.scroll-cue .cue-line {
  display: block; width: 1px; height: 48px; margin: 0 auto 10px;
  background: rgba(61, 58, 52, .5);
  animation: cuePulse 2.4s ease-in-out infinite;
}
.scroll-cue .cue-label {
  display: block;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(61, 58, 52, .7);
  animation: cuePulse 2.4s ease-in-out infinite;
}
@keyframes cuePulse {
  0%, 100% { opacity: .35; }
  50% { opacity: 1; }
}

/* ---------------- footer ---------------- */
.site-footer {
  margin-top: 0;
  background: var(--color-cloth) var(--linen) repeat;
  border-top: 2px dashed rgba(90, 143, 90, .28);
  padding: 44px 0 40px;
  text-align: center;
  color: var(--muted); font-size: 14px;
  display: flex; flex-direction: column; gap: 8px;
  scroll-margin-top: 64px;
}
.site-footer a { color: var(--muted); }
.site-footer .stitched-rule {
  width: min(1120px, calc(100% - 32px)); margin: 0 auto 16px;
  border-bottom: 2px dashed rgba(90, 143, 90, .3);
}

/* ---------------- empty / loading ---------------- */
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.spinner {
  width: 26px; height: 26px; margin: 20px auto;
  border: 3px solid rgba(90, 143, 90, .25); border-top-color: var(--color-meadow);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- toast ---------------- */
#toast-box { position: fixed; top: 76px; right: 18px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #fffdf8; color: var(--ink);
  border: 1px solid rgba(90, 143, 90, .3);
  padding: 12px 18px; border-radius: 16px; font-size: 15px;
  box-shadow: var(--shadow-card); max-width: 340px;
}
.toast.ok { border-color: rgba(90, 143, 90, .45); }
.toast.err { border-color: rgba(212, 160, 160, .7); }

/* ---------------- reveal (opacity + blur, no displacement) ---------------- */
.content-card { transition: box-shadow .4s ease-out, transform .4s ease-out, opacity .8s ease, filter .8s ease; }
.js-scene .content-card:not(.instant) { opacity: 0; filter: blur(6px); }
.js-scene .content-card.in, .content-card.instant { opacity: 1; filter: blur(0); }

/* ---------------- transition band spacing inside sections ---------------- */
.scene-soft { box-shadow: inset 0 0 0 1px rgba(250, 246, 240, .5); }

/* ---------------- responsive ---------------- */
@media (max-width: 720px) {
  /* parallax off on mobile: fixed backgrounds break */
  .scene { background-attachment: scroll; min-height: auto; padding: 64px 0 56px; }
  .scene-content { padding: 24px 16px; }
  .content-card { padding: 26px 20px; border-radius: 20px; }
  .content-card:hover { transform: none; }
  .transition-band { height: 96px; }
  .site-header .container { gap: 10px; min-height: 56px; }
  .brand { font-size: 17px; }
  .nav { gap: 2px; margin-left: 0; }
  .nav a { padding: 6px 10px; font-size: 13px; }
  .search-bar { flex-direction: column; }
  .search-bar .btn { width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .card { padding: 16px; }
  .section-head { flex-wrap: wrap; }
  .section-head .more { margin-left: auto; }
  .scroll-cue { bottom: 20px; }
  #toast-box { top: 64px; }
  .hero { padding-top: 80px; }
}

/* ---------------- reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:hover, .btn:active, .card:hover, .chip:hover, .content-card:hover { transform: none; }
  .content-card, .js-scene .content-card:not(.instant) { opacity: 1; filter: none; }
}
