/* FII 官方網站｜魔法書頁風格 */
:root {
  --ground: #EEF2EA;
  --paper: #F6F8F2;
  --ink: #1F2A44;
  --ink-soft: #3A4560;
  --muted: #56607A;
  --blue: #3B4C8F;
  --gold: #C9A54A;
  --gold-light: #E3C46A;
  --gold-text: #8A6A1C;
  --cream: #F6F2DF;
  --on-dark-soft: #C8D2DE;
  --line: #DCE3D8;
  --serif-en: 'Cormorant Garamond', serif;
  --serif-tc: 'Noto Serif TC', serif;
  --sans: 'Noto Sans TC', sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.7; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.wrap { max-width: 1160px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.eyebrow { margin: 0; font-family: var(--serif-en); font-style: italic; font-size: 20px; color: var(--gold-text); }
.dark .eyebrow { color: var(--gold-light); }
h1, h2 { font-family: var(--serif-tc); font-weight: 900; margin: 0; }
h2 { font-size: 36px; line-height: 1.3; }
p { margin: 0; }
.dark { background: var(--ink); color: var(--ground); }

.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 32px; border-radius: 999px; font-weight: 700; font-size: 17px; text-decoration: none; border: none; font-family: inherit; cursor: pointer; }
.btn-dark { background: var(--ink); color: var(--cream); }
.btn-dark:hover { color: var(--gold-light); }
.btn-gold { background: var(--gold-light); color: var(--ink); }
.btn-gold:hover { color: var(--ink); background: #EED48A; }
.btn-outline { border: 1.5px solid var(--ink); color: var(--ink); background: transparent; }
.btn-outline-gold { border: 1.5px solid var(--gold-light); color: var(--gold-light); background: transparent; min-height: 48px; padding: 0 26px; }
.btn-outline-gold:hover { color: var(--cream); }
.btn-yt { min-height: 60px; padding: 0 40px; font-size: 18px; background: var(--blue); color: #fff; box-shadow: 0 6px 0 var(--ink); }
.btn-yt:hover { color: #fff; background: #31407A; }
.btn:disabled { background: #C9D0DA; color: #4A5468; cursor: not-allowed; }

/* header */
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 24px; padding-bottom: 24px; }
.logo { display: inline-flex; align-items: center; min-height: 44px; }
.logo img { height: 44px; width: auto; }
.nav { display: flex; flex-wrap: wrap; gap: 24px; font-size: 15px; font-weight: 500; }
.nav a { text-decoration: none; }

/* hero */
.hero { overflow: hidden; overflow: clip; display: flex; flex-wrap: wrap; align-items: center; gap: 48px; padding-top: 24px; padding-bottom: 64px; }
.hero-text { flex: 1 1 400px; min-width: 0; container-type: inline-size; display: flex; flex-direction: column; gap: 24px; }
.hero-text .eyebrow { font-size: 22px; }
.hero h1 { font-size: clamp(32px, 11.5cqi, 61px); line-height: 1.2; }
.hero .quote { font-family: var(--serif-tc); font-size: 22px; font-weight: 600; color: var(--ink-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; }
.hero-art { flex: 1.3 1 400px; min-width: 0; display: flex; justify-content: center; position: relative; --p: 0; }
.ring { position: absolute; left: 50%; transform: translateX(-50%); translate: 0 calc(var(--p) * var(--speed, 0) * 1px); aspect-ratio: 1 / 1; border-radius: 50%; will-change: translate; }
.ring-1 { --speed: 0.28; top: 6%; width: 82%; border: 1.5px solid var(--gold); background: #DDE8E1; }
.ring-2 { --speed: 0.45; rotate: calc(var(--p) * 0.08deg); top: 12%; width: 70%; border: 1px dashed var(--gold); }
.hero-art img { position: relative; max-width: 680px; width: 100%; translate: 0 calc(var(--p) * -0.08px); will-change: translate; }

/* covers */
.covers { padding-top: 40px; padding-bottom: 80px; display: flex; flex-direction: column; gap: 32px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.cover { display: flex; flex-direction: column; gap: 14px; text-decoration: none; color: var(--ink); }
.cover .thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; border: 1px solid var(--gold); }
.cover .thumb-empty { aspect-ratio: 16 / 9; border-radius: 14px; border: 1px solid var(--gold); background: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.cover .thumb-empty span { font-family: var(--serif-en); font-size: 24px; font-weight: 700; color: var(--cream); }
.cover .title { font-weight: 700; font-size: 18px; }
.cover .meta { color: var(--muted); font-size: 14px; }
.center { display: flex; justify-content: center; margin-top: 8px; }

/* marshmallow card */
.mm-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; padding: 32px clamp(24px, 4vw, 48px); border-radius: 24px; border: 1.5px dashed var(--gold); background: var(--paper); text-decoration: none; color: var(--ink); }
.mm-card:hover { color: var(--ink); border-style: solid; }
.mm-card .left { display: flex; align-items: center; gap: 20px; flex: 1 1 360px; min-width: 0; }
.mm-card .title { font-family: var(--serif-tc); font-weight: 900; font-size: 24px; }
.mm-card .sub { color: var(--ink-soft); }
.mm-card .pill { display: inline-flex; align-items: center; min-height: 48px; padding: 0 28px; border-radius: 999px; background: var(--ink); color: var(--cream); font-weight: 700; }

/* support */
.support { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 40px; padding-top: 88px; padding-bottom: 88px; }
.support .text { flex: 1 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.support h2 { font-size: 40px; }
.support .desc { color: var(--on-dark-soft); max-width: 34em; }
.support .btn { min-height: 56px; padding: 0 40px; font-size: 18px; }

/* about */
.about { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-start; padding-top: 88px; padding-bottom: 88px; }
.about .head { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.about .card { flex: 2 1 520px; min-width: 0; border: 1.5px solid var(--gold); border-radius: 18px; padding: 36px; background: var(--paper); display: flex; flex-direction: column; gap: 20px; }
.about .rule { height: 1px; background: var(--line); }
.about .en { font-family: var(--serif-en); }

/* team */
.team { display: flex; flex-wrap: wrap; align-items: center; gap: 28px; padding-top: 40px; padding-bottom: 40px; }
.team .mark { flex: 0 1 130px; min-width: 0; display: flex; justify-content: center; }
.team .mark img { max-width: 130px; width: 100%; }
.team .text { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.team .eyebrow { font-size: 16px; }
.team h2 { font-size: 22px; }
.team .desc { color: var(--on-dark-soft); max-width: 34em; }
.team .actions { gap: 10px; margin-top: 6px; }
.team .btn { min-height: 40px; padding: 0 20px; font-size: 14px; gap: 8px; }

/* footer */
.site-footer { border-top: 1px solid #C9D3C8; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding-top: 32px; padding-bottom: 32px; font-size: 14px; color: var(--muted); }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 20px; }

/* marshmallow page */
.mm-main { max-width: 760px; margin: 0 auto; padding: 24px 24px 96px; display: flex; flex-direction: column; gap: 32px; }
.mm-intro { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.mm-intro h1 { font-size: clamp(34px, 5vw, 48px); line-height: 1.3; }
.mm-intro p.sub { color: var(--ink-soft); max-width: 30em; }
.mm-form { border: 1.5px solid var(--gold); border-radius: 24px; background: #fff; padding: clamp(24px, 4vw, 40px); display: flex; flex-direction: column; gap: 16px; }
.mm-form label { font-weight: 700; font-size: 17px; }
.mm-form textarea { width: 100%; resize: vertical; border: 1.5px solid #C2D1C7; border-radius: 16px; padding: 16px; font-family: inherit; font-size: 17px; line-height: 1.7; color: var(--ink); background: var(--paper); }
.mm-form .row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.mm-form .count { color: var(--muted); font-size: 14px; }
.mm-error { color: #A8463C; font-size: 15px; }
.mm-done { border: 1.5px solid var(--gold); border-radius: 24px; background: var(--ink); color: var(--ground); padding: 48px 32px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.mm-done .big { font-family: var(--serif-tc); font-weight: 900; font-size: 28px; }
.mm-done .soft { color: var(--on-dark-soft); }
.mm-notes { border-radius: 18px; background: var(--paper); border: 1px solid var(--line); padding: 24px 28px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; color: var(--ink-soft); }
.mm-notes strong { color: var(--ink); }
[hidden] { display: none !important; }

/* language switch */
.header-right { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.lang-switch { display: flex; gap: 4px; font-size: 14px; }
.lang-switch a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid transparent; text-decoration: none; }
.lang-switch a[aria-current="page"] { border-color: var(--gold); color: var(--ink); font-weight: 700; }

/* per-language fonts: kanji glyph shapes differ between TC and JP */
[lang|="zh"] { --serif-tc: 'Noto Serif TC', serif; --sans: 'Noto Sans TC', sans-serif; font-family: var(--sans); }
[lang|="ja"] { --serif-tc: 'Noto Serif JP', serif; --sans: 'Noto Sans JP', sans-serif; font-family: var(--sans); }
/* hero title: break only between phrases (<wbr>) for CJK, balance line lengths */
.hero h1, .eyebrow { text-wrap: balance; }
p { text-wrap: pretty; }
html[lang|="zh"] .hero h1, html[lang|="ja"] .hero h1,
html[lang|="zh"] .hero .quote, html[lang|="ja"] .hero .quote { word-break: keep-all; }
html[lang|="ja"] .hero h1 { font-size: clamp(30px, 10cqi, 56px); }

/* ===== motion & micro-interactions =====
   js-motion is added by motion.js; without JS (or with reduced motion) everything shows normally. */

/* hero: idle float on the illustration */
@keyframes fii-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.js-motion .hero-art img { animation: fii-float 6s ease-in-out infinite; }

/* hero: entrance sequence on page load */
@keyframes fii-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fii-appear { from { opacity: 0; scale: 0.94; } to { opacity: 1; scale: 1; } }
.js-motion .hero-text > * { animation: fii-rise 0.8s cubic-bezier(.2,.7,.2,1) both; }
.js-motion .hero-text > :nth-child(2) { animation-delay: 0.1s; }
.js-motion .hero-text > :nth-child(3) { animation-delay: 0.2s; }
.js-motion .hero-text > :nth-child(4) { animation-delay: 0.3s; }
.js-motion .hero-art { animation: fii-appear 1.1s cubic-bezier(.2,.7,.2,1) 0.15s both; }

/* sections: fade in when scrolled into view */
.js-motion .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(.2,.7,.2,1); transition-delay: var(--delay, 0s); }
.js-motion .reveal.is-in { opacity: 1; transform: none; }

/* buttons: lift */
.btn { transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn-yt:hover { box-shadow: 0 8px 0 var(--ink); }
.btn-yt:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--ink); }
.btn svg { transition: transform 0.4s ease; }
.btn:hover svg { transform: rotate(72deg) scale(1.1); }
.btn-yt:hover svg, .team .btn:hover svg, .mm-form .btn:hover svg { transform: scale(1.1); }

/* cover cards: lift + gold glow, title color shift */
.cover .thumb, .cover .thumb-empty { transition: transform 0.35s cubic-bezier(.2,.7,.2,1), box-shadow 0.35s ease; }
.cover:hover .thumb, .cover:hover .thumb-empty { transform: translateY(-6px); box-shadow: 0 14px 28px -12px rgba(31, 42, 68, 0.45), 0 0 0 3px var(--gold-light); }
.cover .title { transition: color 0.2s ease; }
.cover:hover .title { color: var(--blue); }

/* marshmallow card: icon bounce */
@keyframes fii-bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-8px) rotate(-6deg); } 70% { transform: translateY(0) rotate(3deg); } }
.mm-card svg { transition: transform 0.3s ease; }
.mm-card:hover svg { animation: fii-bounce 0.7s ease; }
.mm-card .pill { transition: transform 0.2s ease, background-color 0.2s ease; }
.mm-card:hover .pill { transform: translateX(4px); background: var(--blue); }

/* nav: gold underline grows from the center */
.nav a { position: relative; }
.nav a::after { content: ""; position: absolute; left: 50%; right: 50%; bottom: -4px; height: 1.5px; background: var(--gold); transition: left 0.25s ease, right 0.25s ease; }
.nav a:hover::after, .nav a:focus-visible::after { left: 0; right: 0; }
.lang-switch a { transition: border-color 0.2s ease; }
.lang-switch a:hover { border-color: var(--line); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .ring, .hero-art img { translate: none !important; rotate: none !important; }
  .btn:hover, .cover:hover .thumb, .cover:hover .thumb-empty { transform: none; }
}

/* ===== hamburger menu ===== */
.menu-toggle { display: none; }

/* ===== mobile ===== */
@media (max-width: 720px) {
  /* header: logo left, language + menu right, nav drops down */
  .site-header { position: relative; flex-wrap: nowrap; padding-top: 16px; padding-bottom: 16px; }
  .logo img { height: 36px; }
  .header-right { gap: 8px; flex-wrap: nowrap; }
  .lang-switch a { padding: 0 8px; font-size: 13px; }
  .js .menu-toggle { display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; width: 44px; height: 44px; border: 1.5px solid var(--ink); border-radius: 999px; background: transparent; cursor: pointer; padding: 0; }
  .menu-toggle span { display: block; width: 18px; height: 1.5px; background: var(--ink); transition: transform 0.25s ease, opacity 0.2s ease; }
  .menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
  .js .nav { display: none; position: absolute; z-index: 20; top: 100%; left: 24px; right: 24px; flex-direction: column; gap: 0; padding: 8px 20px; background: var(--paper); border: 1.5px solid var(--gold); border-radius: 18px; box-shadow: 0 16px 32px -16px rgba(31, 42, 68, 0.35); font-size: 17px; }
  .js .nav.is-open { display: flex; }
  .nav a { display: flex; align-items: center; min-height: 48px; border-bottom: 1px solid var(--line); }
  .nav a:last-child { border-bottom: none; }
  .nav a::after { display: none; }

  /* type scale */
  h2, .support h2 { font-size: 28px; }
  .eyebrow { font-size: 17px; }
  .hero-text .eyebrow { font-size: 18px; }
  .hero .quote { font-size: 18px; }

  /* hero: text first, full-width buttons, illustration below */
  .hero { gap: 32px; padding-top: 16px; padding-bottom: 40px; }
  .hero-text { gap: 18px; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions .btn { justify-content: center; }

  /* sections: tighter vertical rhythm, consistent left edge */
  .covers { padding-top: 24px; padding-bottom: 56px; gap: 24px; }
  .center { justify-content: stretch; }
  .btn-yt { width: 100%; justify-content: center; padding: 0 20px; font-size: 16px; min-height: 56px; }
  .mm-card { flex-direction: column; align-items: stretch; padding: 24px; gap: 20px; }
  .mm-card .left { flex-basis: auto; align-items: flex-start; }
  .mm-card .title { font-size: 21px; }
  .mm-card .pill { justify-content: center; }
  .support { padding-top: 56px; padding-bottom: 56px; gap: 24px; }
  .support .text { flex-basis: auto; }
  .support .btn { width: 100%; justify-content: center; padding: 0 20px; }
  .about { padding-top: 56px; padding-bottom: 56px; gap: 24px; }
  .about .head, .about .card { flex-basis: 100%; }
  .about .card { padding: 24px; }
  .team { padding-top: 40px; padding-bottom: 40px; gap: 20px; align-items: flex-start; }
  .team .mark { flex: 0 0 auto; justify-content: flex-start; }
  .team .mark img { max-width: 96px; }
  .team .actions { flex-direction: row; flex-wrap: wrap; }
  .site-footer .wrap { flex-direction: column; align-items: flex-start; }

  /* marshmallow pages: header has no menu, let it wrap */
  .site-header:not(:has(.menu-toggle)) { flex-wrap: wrap; }
  .site-header:not(:has(.menu-toggle)) .header-right { flex-wrap: wrap; justify-content: space-between; width: 100%; }
}
