/* Base theme inspired by Apple.com: clean, spacious, high-contrast surfaces */
:root {
  --bg: #ffffff;
  --surface: #f5f5f7;
  --text: #111111;
  --muted: #6e6e73;
  --border: rgba(0,0,0,0.08);
  --brand: #0071e3;
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.08), 0 2px 10px rgba(15, 23, 42, 0.06);

  /* Navbar (dark, editable)rgba(17,17,17,0.72) */
  --nav-bg: rgba(var(--bg-navy-rgb), 0.97);     /* 灰黑透明背景 */
  --nav-text: white;                /* 導覽文字顏色 */
  --nav-active-bg: transparent;       /* 取消選擇效果，可改回其他值 */
  --nav-border: rgba(var(--bg-navy-rgb), 0.92);
  --nav-panel-bg: rgba(var(--bg-navy-rgb), 0.92);/* 行動選單背景 */
  --bg-navy-rgb: 14, 22, 42;
  --bg-opacity: 0.9;
  /* Logo size */
  --brand-logo-h: 54px;               /* 調整 Logo 高度 */

  /* Navbar height (proportional control) */
  --nav-h-base: 56px;                 /* 基準高度 */
  --nav-h-scale: 0.95;                   /* 比例因子（例如 0.9、1.05）*/
  --nav-h: calc(var(--nav-h-base) * var(--nav-h-scale));

  /* Layout width (RWD adjustable) */
  --container-width: 94%;
  --container-max: 1480px;

  /* Hero video overlay (readability, frosted) */
  --hero-overlay: rgba(0,0,0,0.25);   /* 舊的深色疊層（保留相容）*/
  --hero-frost-bg: rgba(255,255,255,0.1); /* 霧面白灰背景（調整透明度）*/
  --hero-frost-blur: 0px;             /* 模糊強度 */
  --hero-frost-saturate: 100%;        /* 背景飽和度（%）*/

  /* Hero controls */
  --hero-min-h: 56vh;
  --hero-pad-top: 96px;
  --hero-pad-bottom: 72px;
  --hero-font: inherit;               /* 字型（例如 'SF Pro Display'）*/
  --hero-title-size: clamp(40px, 7vw, 80px);
  --hero-title-color: var(--text);
  --hero-subtitle-size: clamp(18px, 2.4vw, 24px);
  --hero-subtitle-color: var(--muted);

  /* Hero framing on scroll */
  --hero-frame-radius: 24px;          /* 收縮後圓角 */
  --hero-shrink: 0;                   /* 0~1 收縮進度（JS 控制）*/
  --hero-shadow-a: 0;                 /* 陰影透明度（JS 控制）*/

  /* Pre-hero headline band (navy with grain) */
  --prehero-bg: rgba(var(--bg-navy-rgb), var(--bg-opacity));              /* 海軍藍背景 */
  --prehero-min-h: 18vh;
  --prehero-pad-top: clamp(28px, 3vw, 44px);
  --prehero-pad-bottom: clamp(18px, 2vw, 30px);
  --prehero-gap: 12px;                /* 左右間距 */
  --prehero-title-l-size: clamp(52px, 8vw, 96px);
  --prehero-title-r-size: clamp(24px, 3.2vw, 38px);
  --prehero-title-l-color: white;
  --prehero-title-r-color: white;   /* 淡藍 */
  --prehero-font: inherit;            /* 自訂字型 */
  --prehero-grain-opacity: 0.18;      /* 顆粒透明度 */
  --prehero-grain-size: 140px;        /* 顆粒貼圖尺寸 */

  /* Modal controls */
  --modal-max-w: 1080px;
  --modal-max-h: 86vh;
  --modal-radius: 16px;
  --modal-bg: #ffffff;
  --modal-shadow: 0 24px 64px rgba(0,0,0,0.25), 0 8px 24px rgba(0,0,0,0.18);
  --modal-backdrop: rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "PingFang TC", "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container { width: var(--container-width); max-width: var(--container-max); margin: 0 auto; }

/* Header / Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: saturate(180%) blur(20px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
}
.nav { display: flex; align-items: center; justify-content: center; gap: 16px; height: var(--nav-h); }
.brand { display: inline-flex; align-items: center; justify-content: center; }
.brand-logo { height: var(--brand-logo-h); width: auto; display: block; }
.nav-links { display: flex; align-items: center; justify-content: center; gap: 20px; }
.site-header a { color: var(--nav-text); }
.nav-links a { color: var(--nav-text); padding: 6px 8px; border-radius: 8px; }
.nav-links a.active { background: var(--nav-active-bg); }
.nav-links .cta { margin-left: 4px; }
.nav-toggle { display: none; background: transparent; border: 0; font-size: 22px; color: var(--nav-text); }

/* Buttons */
.btn { display: inline-block; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--border); transition: 150ms ease; font-weight: 600; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary { background: var(--brand); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; }

/* Hero */
.pre-hero {
  position: relative;
  background: var(--prehero-bg);
  color: #fff;
  min-height: var(--prehero-min-h);
  padding: var(--prehero-pad-top) 0 var(--prehero-pad-bottom);
  overflow: hidden;
  font-family: var(--prehero-font);
}
.pre-hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: var(--prehero-gap);
}
.pre-hero-title-l { margin: 0; margin-left: 5%; font-size: var(--prehero-title-l-size); color: var(--prehero-title-l-color); line-height: 1.05; letter-spacing: -0.02em; }
.pre-hero-title-r { margin: 0; margin-right: 6%; font-size: var(--prehero-title-r-size); color: var(--prehero-title-r-color); line-height: 1.3; letter-spacing: -0.01em; text-align: right; }
.pre-hero::before { content: ""; position: absolute; inset: 0; background: var(--prehero-bg); z-index: 0; }
.pre-hero::after { content: ""; position: absolute; inset: -5%; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='0.5'/></svg>"); background-size: var(--prehero-grain-size) var(--prehero-grain-size); background-repeat: repeat; opacity: var(--prehero-grain-opacity); mix-blend-mode: soft-light; pointer-events: none; z-index: 1; }
@media (max-width: 900px) {
  .pre-hero-inner { grid-template-columns: 1fr; text-align: center; }
  .pre-hero-title-r { text-align: center; }
}

/* Hero */
.hero {
  position: relative;
  padding: var(--hero-pad-top) 0 var(--hero-pad-bottom);
  min-height: var(--hero-min-h);
  background:
    radial-gradient(900px 360px at 50% -10%, rgba(0,113,227,0.18), transparent 60%),
    linear-gradient(180deg, #fbfbfd 0%, #ffffff 52%);
  overflow: hidden;
  font-family: var(--hero-font);
}
.hero.small { padding: 84px 0 48px; min-height: auto; }
.hero-home {
  min-height: 54vh;
  padding-top: 28px;
}
.hero-inner { text-align: center; position: relative; z-index: 2; }
/* Surface that contains the video and overlay; shrinks on scroll */
.hero-surface {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - (100% - var(--container-width)) * var(--hero-shrink));
  max-width: var(--container-max);
  border-radius: calc(var(--hero-frame-radius) * var(--hero-shrink));
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0,0,0,var(--hero-shadow-a));
  transition: width 260ms ease, border-radius 260ms ease, box-shadow 260ms ease;
  z-index: 0;
}
.hero-home .hero-surface {
  top: 24px;
}
.hero-surface .hero-video,
.hero-surface .hero-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hero-frost-bg);
  backdrop-filter: blur(var(--hero-frost-blur)) saturate(var(--hero-frost-saturate));
  -webkit-backdrop-filter: blur(var(--hero-frost-blur)) saturate(var(--hero-frost-saturate));
  z-index: 1;
  pointer-events: none;
}
.hero-title { font-size: var(--hero-title-size); color: var(--hero-title-color); line-height: 1.1; margin: 0 0 12px; letter-spacing: -0.02em; }
.hero-subtitle { font-size: var(--hero-subtitle-size); color: var(--hero-subtitle-color); margin: 0 auto 16px; max-width: 860px; }
.hero-actions { display: inline-flex; gap: 12px; margin-top: 10px; }

/* Sections */
.section { padding: 76px 0; }
.section.surface { background: var(--surface); }
.section-title {
  margin: 0 0 24px;
  font-size: clamp(30px, 4.2vw, 56px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

/* Grid */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }

@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Cards */
.card { background: #fff; border: 1px solid var(--border); border-radius: 24px; padding: 22px; box-shadow: var(--shadow); }
.card { position: relative; }
.card .card-open { position: absolute; right: 10px; top: 10px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--brand); text-decoration: none; box-shadow: var(--shadow); transition: transform 120ms ease, box-shadow 120ms ease; }
.card .card-open:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,0.18); }
.card.soft {
  border-color: rgba(0,0,0,0.05);
  box-shadow: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(247,248,252,0.96));
}
.card h3 { margin: 4px 0 8px; font-size: 18px; }
.card p { margin: 0; color: var(--muted); }

/* Pricing */
.pricing .price { text-align: center; position: relative; }
.price .price-tag { font-size: 22px; font-weight: 700; margin: 4px 0 14px; }
.price ul { list-style: none; padding: 0; margin: 0 0 14px; color: var(--muted); }
.price li { padding: 4px 0; }
.price .badge { position: absolute; top: -10px; right: 12px; background: #ff9f0a; color: #fff; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.price.featured { border: 2px solid var(--brand); }

/* Modal */
.modal { position: fixed; inset: 0; display: none; z-index: 2000; }
.modal.open { display: grid; place-items: center; }
.modal-backdrop { position: absolute; inset: 0; background: var(--modal-backdrop); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal-dialog { position: relative; width: min(96%, var(--modal-max-w)); height: min(94vh, var(--modal-max-h)); background: var(--modal-bg); border-radius: var(--modal-radius); box-shadow: var(--modal-shadow); overflow: hidden; display: grid; grid-template-rows: 1fr; align-items: stretch; }
.modal-close { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border-radius: 999px; border: 0; background: rgba(0,0,0,0.5); color: #fff; font-size: 22px; cursor: pointer; z-index: 2; }
.modal-frame { width: 100%; height: 100%; border: 0; }

/* CTA Band */
.cta-band {
  background: linear-gradient(180deg, #eff2f9 0%, #ffffff 100%);
  padding: 36px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cta-inner h3 { margin: 0; }
@media (max-width: 720px) {
  .cta-inner { flex-direction: column; text-align: center; }
}

/* Footer */
.site-footer { padding: 32px 0; background: var(--surface); margin-top: 48px; border-top: 1px solid var(--border); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot-brand { font-weight: 700; }
.foot-links { display: flex; gap: 16px; }
.foot-copy { color: var(--muted); font-size: 14px; }

/* Content spacing */
.content { padding-top: 18px; padding-bottom: 24px; }

/* Forms */
.form { margin-top: 8px; }
.form-control { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-control label { font-weight: 600; }
.form-control input, .form-control textarea {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font: inherit;
}
.form-control textarea { resize: vertical; }
.form .span-2 { grid-column: span 2; }
.form-actions { margin-top: 8px; }

/* Alerts */
.alert { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); }
.alert.success { background: #ecfdf5; border-color: #a7f3d0; }

/* Mobile Nav */
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav-links { position: fixed; inset: var(--nav-h) 0 auto 0; background: var(--nav-panel-bg); backdrop-filter: blur(20px); border-bottom: 1px solid var(--nav-border); flex-direction: column; align-items: stretch; gap: 0; padding: 10px; transform: translateY(-110%); transition: transform 200ms ease; }
  .nav-links a, .nav-links .btn { padding: 12px 14px; border-radius: 10px; color: var(--nav-text); }
  body.nav-open .nav-links { transform: translateY(0); }
}

/* --------------------------------------------------
   Card slider under hero (10 cards)
   -------------------------------------------------- */
.cards-section { position: relative; padding: 24px 0 56px; }
.cards-viewport {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 14px; /* leave room for shadow */
}
.cards-viewport::-webkit-scrollbar { display: none; }
.cards-viewport { -ms-overflow-style: none; scrollbar-width: none; }
.cards-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 326px; /* card width */
  gap: 36px;
}
.story-card {
  position: relative;
  width: 326px;
  height: 560px;
  border-radius: 24px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  color: #fff;
  box-shadow: var(--shadow);
  scroll-snap-align: start;
}
.story-card::after { /* subtle gradient for readability */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.10) 40%, rgba(0,0,0,0.25));
  pointer-events: none;
}
.story-card-content {
  position: absolute; left: 16px; right: 16px; top: 16px;
  z-index: 2;
}
.story-card .eyebrow { font-size: 20px; opacity: .9; margin-bottom: 4px; }
.story-card h3 { margin: 0; font-size: 24px; line-height: 1.3; }
.story-card-more {
  position: absolute; right: 14px; bottom: 14px; z-index: 2;
  width: 36px; height: 36px; border-radius: 999px;
  border: 0; background: rgba(0,0,0,0.55); color: #fff;
  display: grid; place-items: center; cursor: pointer;
  font-size: 20px; line-height: 1; font-weight: 700;
  backdrop-filter: saturate(140%) blur(2px);
}
.story-card-more:hover { transform: translateY(-1px); }

.cards-arrows { position: absolute; right: 8px; bottom: 8px; display: inline-flex; gap: 10px; }
.cards-arrow {
  width: 36px; height: 36px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; color: #333;
  display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow);
  font-size: 18px; line-height: 1;
}
.cards-arrow:disabled { opacity: 0.4; cursor: default; }

/* Story card backgrounds generated to match each card's message */
.story-card.bg-1 { background-image: url("/static/img/storycards/storycard-01.jpg"); }
.story-card.bg-2 { background-image: url("/static/img/storycards/storycard-02.jpg"); }
.story-card.bg-3 { background-image: url("/static/img/storycards/storycard-03.jpg"); }
.story-card.bg-4 { background-image: url("/static/img/storycards/storycard-04.jpg"); }
.story-card.bg-5 { background-image: url("/static/img/storycards/storycard-05.jpg"); }
.story-card.bg-6 { background-image: url("/static/img/storycards/storycard-06.jpg"); }
.story-card.bg-7 { background-image: url("/static/img/storycards/storycard-07.jpg"); }
.story-card.bg-8 { background-image: url("/static/img/storycards/storycard-08.jpg"); }
.story-card.bg-9 { background-image: url("/static/img/storycards/storycard-09.jpg"); }
.story-card.bg-10 { background-image: url("/static/img/storycards/storycard-10.jpg"); }

/* Removed old text modal (.card-modal). Using iframe modal (#card-modal) instead. */

/* Marketing layout */
.eyebrow-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 113, 227, 0.08);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.eyebrow-label-light {
  background: rgba(255,255,255,0.12);
  color: #ffffff;
}

.section-copy {
  margin: 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.7;
}

.lead-intro,
.showcase-split,
.form-layout,
.proof-grid,
.product-grid {
  display: grid;
  gap: 20px;
}

.lead-intro,
.showcase-split {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: stretch;
}

.lead-panel,
.product-panel,
.form-side {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 32px;
  box-shadow: var(--shadow);
}

.lead-panel {
  padding: 28px;
}

.lead-panel-main {
  background:
    radial-gradient(circle at top left, rgba(0, 113, 227, 0.14), transparent 32%),
    linear-gradient(180deg, #ffffff, #f7fafe);
}

.stack-list,
.inline-points {
  margin: 0;
  padding: 0;
  list-style: none;
}

.stack-list {
  display: grid;
  gap: 14px;
}

.stack-list li,
.inline-points li {
  color: var(--muted);
  line-height: 1.7;
}

.stack-list li {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.stack-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.stack-list.compact {
  gap: 10px;
}

.stack-list.compact li {
  padding-bottom: 10px;
}

.metric-row,
.protocol-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.metric-row {
  margin-top: 18px;
}

.metric-pill,
.protocol-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.92);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.product-grid {
  grid-template-columns: repeat(2, minmax(0,1fr));
}

.product-panel {
  overflow: hidden;
}

.product-panel-dark {
  background: linear-gradient(180deg, #08111f 0%, #0f1b34 100%);
  border-color: rgba(255,255,255,0.08);
  color: #ffffff;
}

.product-panel-dark .product-body p,
.product-panel-dark .inline-points li {
  color: rgba(255,255,255,0.76);
}

.product-panel-dark .inline-points li {
  border-top-color: rgba(255,255,255,0.12);
}

.product-panel-dark .btn-primary {
  background: #ffffff;
  color: #07111f;
}

.product-panel-light {
  background:
    radial-gradient(circle at top left, rgba(0,113,227,0.12), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #f4f7fc 100%);
}

.product-media,
.showcase-media {
  margin: 0;
  overflow: hidden;
  border-radius: 24px;
  background: #0d1325;
}

.product-media {
  border-radius: 24px 24px 0 0;
}

.product-media img,
.showcase-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-media img {
  aspect-ratio: 16 / 10;
}

.showcase-media img {
  aspect-ratio: 16 / 10;
}

.product-body {
  padding: 28px;
}

.product-body h3,
.proof-grid h3 {
  margin: 14px 0 10px;
  font-size: 28px;
  line-height: 1.15;
}

.product-body p,
.proof-grid p,
.form-side p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.inline-points {
  display: grid;
  gap: 10px;
  margin: 18px 0 22px;
}

.inline-points li {
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.proof-grid {
  grid-template-columns: repeat(3, minmax(0,1fr));
}

.proof-grid .card {
  padding: 22px;
}

.form-layout {
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  align-items: start;
}

.form-side {
  padding: 24px;
}

@media (max-width: 1000px) {
  .lead-intro,
  .showcase-split,
  .product-grid,
  .proof-grid,
  .form-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .section { padding: 60px 0; }
  .pre-hero-title-l,
  .pre-hero-title-r { margin-left: 0; margin-right: 0; }
  .product-body,
  .lead-panel,
  .form-side { padding: 22px; }
  .hero-home {
    min-height: 42vh;
    padding-top: 20px;
  }
  .hero-home .hero-surface {
    top: 16px;
  }
}
