/* ============================================================
   Formosa Books — shared stylesheet
   Palette inspired by the Taiwan leopard cat (石虎):
   tawny fur amber, dark rosette brown, cream belly, forest green
   ============================================================ */
:root {
  --tawny:        #b97b32;
  --tawny-deep:   #8a5719;
  --rosette:      #3d2b1a;
  --ink:          #2b2118;
  --cream:        #faf5ec;
  --cream-deep:   #f1e7d6;
  --forest:       #4f6349;
  --line:         #e0d3bd;
  --white:        #ffffff;
  --maxw: 960px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: Georgia, "Times New Roman", "Noto Serif TC", "PingFang TC", "Microsoft JhengHei", serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.7;
  font-size: 17px;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}
main { flex: 1; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Header / Nav ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 245, 236, 0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; max-width: var(--maxw); margin: 0 auto;
  flex-wrap: wrap; gap: 8px;
}
.brand {
  font-weight: bold; font-size: 1.15rem; color: var(--rosette);
  text-decoration: none; letter-spacing: 0.02em;
  display: flex; align-items: center; gap: 10px;
}
.brand .mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--tawny);
  position: relative; flex-shrink: 0;
}
.brand .mark::before, .brand .mark::after {
  content: ""; position: absolute; border-radius: 50%;
  background: var(--rosette);
}
.brand .mark::before { width: 7px; height: 7px; top: 7px; left: 9px; }
.brand .mark::after  { width: 5px; height: 5px; bottom: 8px; right: 8px; }
nav ul { display: flex; list-style: none; gap: 4px; flex-wrap: wrap; }
nav a {
  text-decoration: none; color: var(--ink);
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.85rem; letter-spacing: 0.04em;
  padding: 6px 10px; border-radius: 6px;
}
nav a:hover { background: var(--cream-deep); color: var(--tawny-deep); }
nav a.active { background: var(--cream-deep); color: var(--tawny-deep); font-weight: bold; }

/* ---------- Hero (home) ---------- */
.hero {
  background:
    radial-gradient(ellipse 55% 70% at 85% 20%, rgba(185,123,50,0.28), transparent 60%),
    radial-gradient(ellipse 40% 55% at 10% 85%, rgba(79,99,73,0.22), transparent 60%),
    var(--rosette);
  color: var(--cream);
  padding: 96px 24px 88px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle 5px at 12% 30%, rgba(185,123,50,0.35) 100%, transparent),
    radial-gradient(circle 4px at 22% 68%, rgba(185,123,50,0.28) 100%, transparent),
    radial-gradient(circle 6px at 78% 74%, rgba(185,123,50,0.30) 100%, transparent),
    radial-gradient(circle 4px at 88% 42%, rgba(185,123,50,0.26) 100%, transparent),
    radial-gradient(circle 5px at 55% 18%, rgba(185,123,50,0.22) 100%, transparent),
    radial-gradient(circle 3px at 40% 85%, rgba(185,123,50,0.30) 100%, transparent);
  pointer-events: none;
}
.hero .wrap { position: relative; z-index: 1; }
.hero h1 {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  line-height: 1.25; font-weight: normal; max-width: 21ch;
}
.hero h1 strong { color: var(--tawny); font-weight: bold; }
.hero p.tagline {
  margin-top: 20px; max-width: 58ch;
  font-size: 1.08rem; color: #e9dfcd;
}
.hero .zh {
  margin-top: 10px; font-size: 0.95rem; font-weight: 600;
  color: #d8cbae; letter-spacing: 0.25em;
}

/* ---------- Page title band (inner pages) ---------- */
.page-head {
  background: var(--rosette); color: var(--cream);
  padding: 52px 24px 44px;
}
.page-head h1 { font-size: 2rem; font-weight: bold; }
.page-head .kicker { color: var(--tawny); }

/* ---------- Buttons ---------- */
.cta {
  display: inline-block; margin-top: 34px;
  background: var(--tawny); color: var(--white);
  text-decoration: none; font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.95rem; letter-spacing: 0.05em;
  padding: 13px 28px; border-radius: 8px;
}
.cta:hover { background: var(--tawny-deep); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.cta-row .cta { margin-top: 0; }
.cta.secondary {
  background: transparent; border: 1px solid rgba(250,245,236,0.6);
  color: var(--cream);
}
.cta.secondary:hover { background: rgba(250,245,236,0.12); }

/* ---------- Sections ---------- */
section { padding: 64px 0; }
section.alt { background: var(--cream-deep); }
h2 { font-size: 1.6rem; color: var(--rosette); margin-bottom: 8px; font-weight: bold; }
.kicker {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--tawny-deep); margin-bottom: 10px;
}
.rule {
  width: 56px; height: 3px; background: var(--tawny);
  border: none; margin: 18px 0 28px; border-radius: 2px;
}
section p { max-width: 68ch; margin-bottom: 16px; }

/* ---------- Cards ---------- */
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 20px; margin-top: 10px;
}
.card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: 12px; padding: 26px 24px;
}
section.alt .card { background: var(--cream); }
.card h3 { font-size: 1.08rem; color: var(--rosette); margin-bottom: 10px; }
.card p { font-size: 0.95rem; margin-bottom: 0; }
.card .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--tawny); color: var(--white);
  font-family: "Helvetica Neue", Arial, sans-serif; font-weight: bold;
  margin-bottom: 14px;
}

/* ---------- Note box ---------- */
.note {
  background: var(--cream-deep); border-left: 4px solid var(--forest);
  border-radius: 0 10px 10px 0; padding: 18px 22px;
  max-width: 72ch; margin-top: 28px;
}
.note p { margin-bottom: 0; font-size: 0.96rem; }

/* ---------- FAQ ---------- */
details {
  background: var(--white); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px 20px; margin-bottom: 12px;
  max-width: 72ch;
}
details summary {
  cursor: pointer; font-weight: bold; color: var(--rosette);
  list-style-position: inside;
}
details p { margin-top: 10px; font-size: 0.96rem; margin-bottom: 0; }
.faq-more { margin-top: 28px; max-width: 72ch; color: #4a4036; }
.faq-more a { color: var(--tawny-deep); }

/* ---------- Contact ---------- */
.contact-box {
  background: var(--rosette); color: var(--cream);
  border-radius: 14px; padding: 40px 36px;
  display: flex; flex-direction: column; gap: 28px; align-items: flex-start;
}
.contact-box h2 { color: var(--cream); }
.contact-box p { color: #e5dbc8; margin-bottom: 0; }
.contact-box a.cta { margin-top: 0; }
.contact-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.contact-actions .form-hint { font-size: 0.9rem; color: #cbbfa8; }
.contact-actions .form-hint a { color: #e0a85f; text-underline-offset: 3px; }
.contact-box a.email { color: #e0a85f; }

/* ---------- Legal ---------- */
.legal h1 { font-size: 1.6rem; color: var(--rosette); margin: 10px 0 8px; font-weight: bold; }
.legal h3 { color: var(--rosette); margin: 26px 0 8px; font-size: 1.05rem; }
.legal p, .legal li { font-size: 0.93rem; color: #4a4036; }
.legal ul { margin: 0 0 14px 22px; }
.updated {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.8rem; color: #6f6350;
}

/* ---------- Footer ---------- */
footer {
  background: var(--rosette); color: #cbbfa8;
  padding: 34px 24px; text-align: center;
  font-family: "Helvetica Neue", Arial, sans-serif; font-size: 0.85rem;
}
footer a { color: #e0a85f; text-decoration: underline; text-underline-offset: 3px; }
footer a:hover { text-decoration: underline; }
footer .paw { color: var(--tawny); }

@media (max-width: 640px) {
  .hero { padding: 64px 24px 56px; }
  section { padding: 48px 0; }
  .contact-box { padding: 30px 24px; }
}

/* four-card grids: 2x2 on desktop instead of 3+1 */
.cards.two { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 96px 0; }
.notfound .code { font-family: "Helvetica Neue", Arial, sans-serif; font-size: 5rem; color: var(--tawny); line-height: 1; margin-bottom: 12px; }
.notfound p { margin: 0 auto 16px; }

/* ---------- Copy-to-clipboard toast ---------- */
.copy-toast {
  position: fixed;
  left: 50%; bottom: 24px;
  transform: translate(-50%, 16px);
  z-index: 100;
  max-width: min(430px, calc(100vw - 32px));
  background: var(--ink);
  color: var(--cream);
  border: 1px solid rgba(250,245,236,0.26);
  border-left: 4px solid var(--tawny);
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: 0 10px 30px rgba(43,33,24,0.32);
  font-family: "Helvetica Neue", Arial, sans-serif;
  opacity: 0; visibility: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}
.copy-toast.is-visible {
  opacity: 1; visibility: visible;
  transform: translate(-50%, 0);
}
.copy-toast strong {
  display: block;
  font-size: 0.95rem; line-height: 1.4;
  word-break: break-word;
}
.copy-toast span {
  display: block; margin-top: 4px;
  font-size: 0.83rem; line-height: 1.45;
  color: #d8c9ae;
}
@media (prefers-reduced-motion: reduce) {
  .copy-toast { transition: opacity 0.01s linear; }
}

/* ---------- "Copied!" feedback at the click point ---------- */
a[href^="mailto:"] { position: relative; }

.cta.is-copied { background: var(--forest); }
a.cta[href^="mailto:"] { white-space: nowrap; }

.copied-flag {
  position: absolute;
  left: 100%; top: 50%;
  margin-left: 8px;
  transform: translateY(-50%) translateX(-4px);
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--tawny);
  color: var(--white);
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 0.72rem; line-height: 1.6;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-decoration: none;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.copied-flag.is-visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
@media (prefers-reduced-motion: reduce) {
  .copied-flag { transition: opacity 0.01s linear; }
}
