/* ===========================
   可信運算平台 - 主樣式表
   色系: 深藍 #0B1633 | 青綠 #00B8A9 | 石灰 #F2F5F8 | 中灰 #627084
   =========================== */

:root {
  --bg: #0B1633;
  --teal: #00B8A9;
  --ink: #0b1220;
  --muted: #627084;
  --paper: #F2F5F8;
  --white: #ffffff;
  --shadow-sm: 0 2px 8px rgba(11, 22, 51, 0.08);
  --shadow-md: 0 6px 16px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 24px rgba(11, 22, 51, 0.12);
  --radius: 16px;
  --radius-sm: 12px;
  --transition: all 0.3s ease;
}

/* ===========================
   Reset & Base
   =========================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--white);
  line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", "Helvetica Neue", Arial, "PingFang TC", "Heiti TC", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===========================
   Layout
   =========================== */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.section {
  padding: 80px 0;
}

.section-tight {
  padding: 56px 0;
}

/* ===========================
   Typography
   =========================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 12px;
}

h1 { font-size: clamp(32px, 5vw, 48px); }
h2 { font-size: clamp(28px, 4vw, 36px); }
h3 { font-size: clamp(20px, 3vw, 24px); }

p {
  margin-bottom: 16px;
  line-height: 1.7;
}

a {
  color: var(--teal);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: #008c7f;
}

/* ===========================
   Navigation
   =========================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #eef2f7;
  z-index: 1000;
  transition: var(--transition);
}

.navbar.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-img {
  width: 70px;
  height: 36px;
  border-radius: 8px;
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  align-items: center;
}

.nav-links a {
  color: var(--ink);
  font-weight: 500;
  font-size: 15px;
  transition: var(--transition);
  position: relative;
}

.nav-links a:hover {
  color: var(--teal);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--teal);
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

/* Ensure button styles in nav */
.nav-links a.btn-primary {
  color: var(--white);
}

.nav-links a.btn-primary:hover {
  color: var(--white);
}

.nav-links a.btn-primary::after {
  display: none; /* Remove underline effect for buttons */
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--ink);
  margin: 5px 0;
  transition: var(--transition);
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 20px;
    gap: 16px;
    box-shadow: var(--shadow-md);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
  }

  .nav-links.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
}

/* ===========================
   Buttons
   =========================== */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  line-height: 1.5;
}

.btn-primary {
  background: var(--teal);
  color: var(--white);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  background: #008c7f;
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-primary:focus-visible {
  outline: 3px solid rgba(0, 184, 169, 0.4);
  outline-offset: 2px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #dfe4ea;
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--teal);
  background: rgba(0, 184, 169, 0.05);
  transform: translateY(-2px);
}

.btn-ghost:focus-visible {
  outline: 3px solid rgba(0, 184, 169, 0.4);
  outline-offset: 2px;
}

/* ===========================
   Hero Section
   =========================== */
.hero {
  background: linear-gradient(180deg, #f7fbff 0%, #fff 100%);
  padding: 120px 0 96px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background:
    radial-gradient(circle at 20% 30%, rgba(0, 184, 169, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 60%, rgba(11, 22, 51, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

.hero .container {
  position: relative;
  z-index: 1;
  max-width: 960px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.15;
  margin-bottom: 20px;
  color: var(--ink);
  font-weight: 700;
}

.hero h2 {
  font-size: clamp(18px, 2.5vw, 20px);
  color: var(--muted);
  margin-bottom: 32px;
  font-weight: 400;
  line-height: 1.6;
}

.hero .cta-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 40px;
}

.hero .trust-note {
  margin-top: 32px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* ===========================
   Card System
   =========================== */
.card {
  background: var(--white);
  border: 1px solid #eef2f7;
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  height: 100%;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(0, 184, 169, 0.2);
}

.card h3 {
  margin-bottom: 12px;
  color: var(--ink);
}

.card p {
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.7;
}

/* ===========================
   Grid System
   =========================== */
.grid-2 {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-4 {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Fixed 2x2 grid layout */
.grid-2x2 {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .grid-2x2 {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   Trust Band (徽章區)
   =========================== */
.trust-band {
  background: var(--paper);
  padding: 40px 0;
  margin: 80px 0;
}

.trust-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 32px;
}

.trust-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  flex: 1;
  min-width: 180px;
}

.trust-icon {
  width: 56px;
  height: 56px;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--shadow-sm);
}

.trust-item p {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

/* ===========================
   Timeline / Steps (時間軸)
   =========================== */
.timeline {
  position: relative;
  padding: 40px 0;
}

.timeline-item {
  display: flex;
  gap: 24px;
  margin-bottom: 48px;
  position: relative;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  background: var(--teal);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 2;
}

.timeline-content {
  flex: 1;
  padding-top: 4px;
}

.timeline-content h3 {
  margin-bottom: 8px;
  font-size: 20px;
}

.timeline-content p {
  color: var(--muted);
  margin: 0;
}

/* Vertical line */
.timeline-item:not(:last-child) .timeline-icon::after {
  content: '';
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 48px;
  background: linear-gradient(180deg, var(--teal) 0%, rgba(0, 184, 169, 0.2) 100%);
}

@media (max-width: 640px) {
  .timeline-item {
    flex-direction: column;
    gap: 16px;
  }

  .timeline-item:not(:last-child) .timeline-icon::after {
    display: none;
  }
}

/* ===========================
   CTA Bar (行動呼籲條)
   =========================== */
.cta-bar {
  background: var(--bg);
  color: var(--white);
  padding: 56px 0;
  text-align: center;
}

.cta-bar h2 {
  color: var(--white);
  margin-bottom: 24px;
}

.cta-bar p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  margin-bottom: 32px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

/* ===========================
   FAQ Section
   =========================== */
.faq-item {
  background: var(--white);
  border: 1px solid #eef2f7;
  border-radius: var(--radius-sm);
  padding: 24px;
  margin-bottom: 16px;
  transition: var(--transition);
}

.faq-item:hover {
  border-color: rgba(0, 184, 169, 0.2);
  box-shadow: var(--shadow-sm);
}

.faq-question {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
  font-size: 17px;
}

.faq-answer {
  color: var(--muted);
  margin: 0;
  line-height: 1.7;
}

/* ===========================
   Form Styles
   =========================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #dfe4ea;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  transition: var(--transition);
  background: var(--white);
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 184, 169, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

/* ===========================
   Footer
   =========================== */
.footer {
  background: var(--bg);
  color: rgba(255, 255, 255, 0.8);
  padding: 48px 0 32px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 40px;
  margin-bottom: 32px;
}

.footer-section {
  flex: 1;
  min-width: 200px;
}

.footer-section h4 {
  color: var(--white);
  margin-bottom: 16px;
  font-size: 16px;
}

.footer-links {
  list-style: none;
  padding: 0;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--teal);
}

.footer-bottom {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}

/* ===========================
   Utilities
   =========================== */
.text-center {
  text-align: center;
}

.text-muted {
  color: var(--muted);
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mb-5 { margin-bottom: 48px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mt-5 { margin-top: 48px; }

/* ===========================
   Reveal Animation
   =========================== */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-on-scroll.reveal {
  opacity: 1;
  transform: translateY(0);
}

/* ===========================
   Back to Top Button
   =========================== */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  background: var(--teal);
  color: var(--white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: all;
}

.back-to-top:hover {
  background: #008c7f;
  transform: translateY(-4px);
}

.back-to-top:focus-visible {
  outline: 3px solid rgba(0, 184, 169, 0.4);
  outline-offset: 2px;
}

/* ===========================
   Accessibility
   =========================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

:focus-visible {
  outline: 3px solid rgba(0, 184, 169, 0.4);
  outline-offset: 2px;
}

/* ===========================
   Download Button Enhancements
   =========================== */
.download-btn {
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
}

.download-btn .download-icon {
  transition: transform 0.3s ease;
}

.download-btn:hover .download-icon {
  transform: translateY(2px);
  animation: bounce-download 0.6s ease;
}

@keyframes bounce-download {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

.download-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.download-btn:active::before {
  width: 300px;
  height: 300px;
}

.download-btn .download-text,
.download-btn .download-icon {
  position: relative;
  z-index: 1;
}

/* Download success animation */
.download-btn.downloading {
  pointer-events: none;
}

.download-btn.downloading .download-icon {
  animation: rotate 1s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.download-btn.success {
  background: #10b981 !important;
}

.download-btn.success .download-icon::before {
  content: '✓';
}

/* ===========================
   Print Styles
   =========================== */
@media print {
  .navbar,
  .back-to-top,
  .cta-buttons {
    display: none;
  }
}
