/* ============ HSK Illustrated — anki.si5.pl ============
   Aesthetic: warm Chinese-textbook editorial. Cream paper, ink text,
   the deck's own tone palette (red/orange/green/blue) + pinyin teal. */

@font-face {
  font-family: "HanziFont";
  src: url("previews/_hanzifont.woff2") format("woff2");
  font-display: swap;
}

:root {
  --paper: #faf6ee;
  --paper-deep: #f3ecdf;
  --ink: #28282d;
  --ink-soft: #5c5c63;
  --teal: #009688;
  --teal-dark: #00786d;
  --t1: #e53935; --t2: #fb8c00; --t3: #43a047; --t4: #1e88e5;
  --card: #ffffff;
  --line: #e3dccc;
  --disp: "Fraunces", Georgia, serif;
  --body: "Karla", -apple-system, sans-serif;
  --hanzi: "HanziFont", "Songti SC", serif;
  --shadow: 0 24px 60px -24px rgba(40, 40, 45, .35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background:
    radial-gradient(1100px 500px at 85% -100px, rgba(0, 150, 136, .07), transparent 60%),
    var(--paper);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--disp); line-height: 1.08; margin: 0; }
a { color: var(--teal-dark); }
em { font-style: italic; }

/* paper grain */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 999;
  opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- tone bar motif ---------- */
.tonebar {
  display: inline-block; width: 56px; height: 5px; border-radius: 3px; vertical-align: middle;
  background: linear-gradient(90deg, var(--t1) 0 25%, var(--t2) 25% 50%, var(--t3) 50% 75%, var(--t4) 75% 100%);
}
.tonebar.wide { width: 96px; height: 6px; }
.tonebar-rule {
  height: 5px; max-width: 1100px; margin: 0 auto; border-radius: 3px;
  background: linear-gradient(90deg, var(--t1) 0 25%, var(--t2) 25% 50%, var(--t3) 50% 75%, var(--t4) 75% 100%);
  opacity: .85;
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  padding: 14px clamp(20px, 4vw, 48px);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-hanzi {
  font-family: var(--hanzi); font-size: 26px; line-height: 1; color: #fff;
  background: var(--teal); border-radius: 10px; padding: 7px 8px 9px;
  box-shadow: 0 3px 10px rgba(0, 150, 136, .35);
}
.brand-name { font-family: var(--disp); font-weight: 700; font-size: 21px; letter-spacing: .2px; }
.brand-name em { color: var(--teal-dark); }
.topnav { display: flex; gap: 22px; margin-left: auto; }
.topnav a { text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: 15px; }
.topnav a:hover { color: var(--teal-dark); }
@media (max-width: 720px) { .topnav { display: none; } .topbar { justify-content: space-between; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; background: var(--ink); color: var(--paper); text-decoration: none;
  font-family: var(--body); font-weight: 700; border: none; cursor: pointer;
  border-radius: 999px; transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--teal-dark); transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgba(0, 120, 109, .6); }
.btn-small { padding: 9px 20px; font-size: 15px; }
.btn-big { padding: 15px 30px; font-size: 17px; }
.btn .arrow { display: inline-block; transition: transform .15s; }
.btn:hover .arrow { transform: translateX(4px); }
.ghostlink { color: var(--ink-soft); font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--line); }
.ghostlink:hover { color: var(--teal-dark); border-color: var(--teal); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(40px, 7vw, 90px) clamp(20px, 4vw, 48px) 70px; }
.hero-watermark {
  position: absolute; right: -4%; top: -12%; font-family: var(--hanzi);
  font-size: clamp(320px, 42vw, 640px); line-height: 1; color: var(--ink);
  opacity: .045; pointer-events: none; user-select: none;
}
.hero-inner {
  max-width: 1180px; margin: 0 auto; display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  gap: clamp(32px, 5vw, 72px); align-items: center;
}
@media (max-width: 920px) { .hero-inner { grid-template-columns: 1fr; } }

.kicker {
  font-weight: 800; letter-spacing: 2.5px; text-transform: uppercase; font-size: 13px;
  color: var(--teal-dark); display: flex; align-items: center; gap: 12px; margin: 0 0 18px;
}
.hero h1 {
  font-size: clamp(44px, 6vw, 76px); font-weight: 800; letter-spacing: -1px;
  line-height: 1.28;  /* room for the tone underlines between lines */
  animation: rise .7s cubic-bezier(.2, .7, .2, 1) both;
}
.hero h1 em { font-weight: 500; color: var(--ink-soft); display: inline-block; font-size: .72em; margin-top: 10px; }
.u { white-space: nowrap; box-decoration-break: clone; padding-bottom: .02em; }
.u1 { border-bottom: .08em solid var(--t1); }
.u2 { border-bottom: .08em solid var(--t2); }
.u3 { border-bottom: .08em solid var(--t3); }
.lede { max-width: 56ch; font-size: 18.5px; color: var(--ink-soft); margin: 24px 0 30px; animation: rise .7s .08s cubic-bezier(.2, .7, .2, 1) both; }
.lede strong { color: var(--ink); }
.hero-cta { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; animation: rise .7s .16s cubic-bezier(.2, .7, .2, 1) both; }

.stats { display: flex; gap: clamp(22px, 4vw, 48px); flex-wrap: wrap; margin: 44px 0 0; padding: 0; animation: rise .7s .24s cubic-bezier(.2, .7, .2, 1) both; }
.stats div { border-left: 3px solid var(--teal); padding-left: 14px; }
.stats dt { font-family: var(--disp); font-size: 30px; font-weight: 800; }
.stats dd { margin: 2px 0 0; color: var(--ink-soft); font-size: 14.5px; }

@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }

/* ---------- phone frame ---------- */
.hero-phone { justify-self: center; animation: rise .8s .2s cubic-bezier(.2, .7, .2, 1) both; }
.phone {
  position: relative; width: min(355px, 88vw); height: 660px;
  background: #111; border-radius: 44px; padding: 14px 12px 56px;
  box-shadow: var(--shadow), inset 0 0 0 2px #2c2c30;
}
.phone .screen {
  position: relative; width: 100%; height: 100%;
  border-radius: 30px; overflow: hidden; background: #fff;
}
/* render the card at ~143% size, scale to 70% — whole card fits the screen */
.phone iframe {
  position: absolute; top: 0; left: 0;
  width: 142.86%; height: 142.86%; border: 0; background: #fff; display: block;
  transform: scale(.7); transform-origin: top left;
}
.ankibar {
  position: absolute; left: 12px; right: 12px; bottom: 12px; height: 40px;
  border: none; border-radius: 0 0 30px 30px; cursor: pointer;
  background: #f2f2f2; color: var(--teal-dark); font-weight: 700; font-size: 15px;
  font-family: var(--body); border-top: 1px solid #ddd;
  transition: background .12s;
}
.ankibar:hover { background: #e9f4f2; }
.phone-caption { text-align: center; color: var(--ink-soft); font-size: 14.5px; margin-top: 18px; }

/* ---------- features ---------- */
.features { max-width: 1180px; margin: 0 auto; padding: clamp(50px, 7vw, 90px) clamp(20px, 4vw, 48px); }
.features h2, .faq h2 { font-size: clamp(30px, 3.6vw, 44px); font-weight: 800; margin-bottom: 44px; position: relative; }
.sec-hanzi {
  font-family: var(--hanzi); display: block; font-size: .55em; color: var(--teal);
  letter-spacing: 6px; margin-bottom: 6px; font-weight: 400;
}
.featgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.feat {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 24px 24px 26px; box-shadow: 0 10px 30px -18px rgba(40, 40, 45, .25);
  transition: transform .18s ease, box-shadow .18s ease;
}
.feat:hover { transform: translateY(-5px); box-shadow: 0 22px 44px -20px rgba(40, 40, 45, .35); }
.feat h3 { font-size: 21px; font-weight: 700; margin: 18px 0 8px; }
.feat p { color: var(--ink-soft); font-size: 15.5px; margin: 0; }
.feat-demo {
  height: 130px; border-radius: 14px; background: var(--paper-deep);
  display: flex; align-items: center; justify-content: center; gap: 14px; overflow: hidden;
}
.demo-img img { height: 100%; width: 100%; object-fit: cover; border-radius: 14px; }
.demo-tones .hz { font-family: var(--hanzi); font-size: 52px; padding-bottom: 4px; }
.t1 { border-bottom: 5px solid var(--t1); } .t2 { border-bottom: 5px solid var(--t2); }
.t3 { border-bottom: 5px solid var(--t3); } .t4 { border-bottom: 5px solid var(--t4); }
.ttx { border-bottom-width: 3px; font-weight: 700; padding-bottom: 1px; }
.demo-viz { gap: 10px; }
.mv { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mv-py { color: var(--teal); font-size: 13px; font-weight: 700; }
.mv-hz { font-family: var(--hanzi); font-size: 30px; }
.mv b { color: #fff; font-size: 11.5px; border-radius: 5px; padding: 3px 10px; font-weight: 700; }
.mv.hl .mv-py, .mv.hl .mv-hz { color: #e06a1b; }
.demo-audio { flex-direction: column; gap: 10px; }
.wave { display: flex; gap: 5px; align-items: flex-end; height: 34px; }
.wave i {
  width: 6px; background: var(--teal); border-radius: 3px; height: 12px;
  animation: wob 1.1s ease-in-out infinite;
}
.wave i:nth-child(2) { animation-delay: .12s; } .wave i:nth-child(3) { animation-delay: .24s; }
.wave i:nth-child(4) { animation-delay: .36s; } .wave i:nth-child(5) { animation-delay: .48s; }
.wave i:nth-child(6) { animation-delay: .60s; } .wave i:nth-child(7) { animation-delay: .72s; }
@keyframes wob { 0%, 100% { height: 10px; } 50% { height: 32px; } }
.demo-play {
  font-family: var(--hanzi); font-size: 19px; background: #fff; border: 1px solid var(--line);
  color: var(--teal-dark); border-radius: 999px; padding: 7px 18px; cursor: pointer;
}
.demo-play:hover { background: #eef7f5; }
.demo-comps { gap: 12px; }
.cmp {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 16px 10px; text-align: center; display: flex; flex-direction: column;
}
.cmp b { font-family: var(--hanzi); font-size: 30px; font-weight: 400; }
.cmp i { color: var(--teal); font-style: normal; font-size: 13.5px; }
.cmp u { text-decoration: none; color: var(--ink-soft); font-size: 12.5px; }
.demo-font .handw { font-family: var(--hanzi); font-size: 52px; letter-spacing: 8px; }

/* ---------- deck showcases ---------- */
.deck { padding: clamp(50px, 7vw, 90px) clamp(20px, 4vw, 48px); }
.deck-alt { background: linear-gradient(180deg, var(--paper-deep), var(--paper)); }
.deck-inner {
  max-width: 1180px; margin: 0 auto; display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: clamp(32px, 5vw, 80px); align-items: center;
}
.deck-alt .deck-inner { grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); }
@media (max-width: 920px) {
  .deck-inner, .deck-alt .deck-inner { grid-template-columns: 1fr; }
  .deck-alt .deck-phone { order: 2; }
}
.deck-no { font-weight: 800; letter-spacing: 2.5px; text-transform: uppercase; font-size: 13px; color: var(--teal-dark); margin: 0 0 10px; }
.deck h2 { font-size: clamp(32px, 3.8vw, 48px); font-weight: 800; }
.deck h2 em { color: var(--teal-dark); }
.deck-sub { font-family: var(--hanzi); font-size: 20px; color: var(--ink-soft); margin: 10px 0 16px; }
.deck-copy > p { color: var(--ink-soft); max-width: 58ch; }
.deck-list { margin: 18px 0; padding: 0; list-style: none; }
.deck-list li { padding: 7px 0 7px 30px; position: relative; color: var(--ink-soft); font-size: 15.5px; }
.deck-list li::before { content: "✓"; position: absolute; left: 4px; color: var(--teal); font-weight: 800; }
.deck-list b { color: var(--ink); }
.deck-file { font-size: 14.5px; color: var(--ink-soft); }
.deck-file code { background: var(--paper-deep); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }
.deck-phone { justify-self: center; }

.word-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.wtab {
  font-family: var(--body); font-weight: 700; font-size: 14.5px; cursor: pointer;
  background: #fff; color: var(--ink-soft); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 8px 16px; transition: all .14s;
}
.wtab:hover { border-color: var(--teal); color: var(--teal-dark); }
.wtab.active { background: var(--teal); border-color: var(--teal); color: #fff; box-shadow: 0 4px 12px rgba(0, 150, 136, .35); }

/* ---------- download ---------- */
.download { padding: clamp(50px, 7vw, 100px) clamp(20px, 4vw, 48px); }
.dl-card {
  max-width: 880px; margin: 0 auto; background: var(--ink); color: var(--paper);
  border-radius: 28px; padding: clamp(36px, 5vw, 64px); text-align: center;
  position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.dl-card::after {
  content: "下载"; position: absolute; right: -20px; bottom: -55px; font-family: var(--hanzi);
  font-size: 200px; line-height: 1; opacity: .07; pointer-events: none;
}
.dl-head h2 { font-size: clamp(30px, 3.6vw, 44px); font-weight: 800; margin: 18px 0 12px; }
.dl-head p { color: #c9c5ba; margin: 0 auto 30px; max-width: 52ch; }
.fieldrow { display: flex; gap: 12px; max-width: 560px; margin: 0 auto; flex-wrap: wrap; justify-content: center; }
#email {
  flex: 1 1 260px; font-family: var(--body); font-size: 17px; color: var(--ink);
  background: var(--paper); border: 2px solid transparent; border-radius: 999px; padding: 14px 24px;
  outline: none; transition: border .15s;
}
#email:focus { border-color: var(--teal); }
.dl-card .btn { background: var(--teal); color: #fff; }
.dl-card .btn:hover { background: var(--teal-dark); }
.dl-card .btn[disabled] { opacity: .6; cursor: wait; transform: none; }
.formnote { color: #97938a; font-size: 13.5px; margin-top: 14px; min-height: 1.4em; }
.formnote.ok { color: #7adfa9; font-size: 16px; font-weight: 700; }
.formnote.err { color: #ff9d96; font-weight: 700; }
.dl-meta { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; margin-top: 30px; color: #97938a; font-size: 14px; }
.dl-meta #dlcount b { color: #7adfa9; }

/* ---------- buy me a coffee ---------- */
.coffee { margin-top: 34px; padding-top: 28px; border-top: 1px solid #44444a; position: relative; }
.coffee p { color: #c9c5ba; font-size: 15px; margin: 0 0 16px; }
.coffee-btn {
  display: inline-block; background: #ffdd00; color: #28282d; text-decoration: none;
  font-weight: 800; font-size: 16px; border-radius: 999px; padding: 13px 28px;
  box-shadow: 0 8px 22px -8px rgba(255, 221, 0, .55);
  transition: transform .15s ease, box-shadow .15s ease;
}
.coffee-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -10px rgba(255, 221, 0, .7); }

/* ---------- faq ---------- */
.faq { max-width: 880px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 48px) clamp(60px, 8vw, 110px); }
.faqgrid details {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 4px 24px; margin-bottom: 12px;
}
.faqgrid summary {
  cursor: pointer; font-weight: 700; font-size: 17px; padding: 16px 0; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.faqgrid summary::after { content: "+"; font-family: var(--disp); font-size: 26px; color: var(--teal); transition: transform .18s; }
.faqgrid details[open] summary::after { transform: rotate(45deg); }
.faqgrid details p { margin: 0 0 18px; color: var(--ink-soft); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- footer ---------- */
.foot { background: var(--ink); color: #c9c5ba; }
.foot-inner {
  max-width: 1180px; margin: 0 auto; padding: 36px clamp(20px, 4vw, 48px);
  display: flex; gap: 18px; align-items: center;
}
.foot p { margin: 0; font-size: 15px; }
.foot-dim { color: #87837a; font-size: 13.5px; }
