@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-dark: #04070a;
  --bg-gradient: radial-gradient(circle at 50% 0%, #0d1b2a 0%, #04070a 65%);
  --card-bg: rgba(22, 32, 50, 0.6);
  --card-bg-hover: rgba(26, 38, 59, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-glow: rgba(16, 185, 129, 0.3);
  --primary: #10b981;
  --primary-light: #34d399;
  --primary-glow: rgba(16, 185, 129, 0.15);
  --sky: #38bdf8;
  --sky-glow: rgba(56, 189, 248, 0.15);
  --purple: #a855f7;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --shadow-card: 0 16px 36px rgba(0, 0, 0, 0.35);
  --max-width: 860px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  scroll-behavior: smooth;
  line-height: 1.6;
}

body {
  min-height: 100vh;
  background: var(--bg-gradient);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Ambient subtle background glow */
body::before {
  content: '';
  position: fixed;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 450px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, rgba(2, 132, 199, 0.08) 50%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  filter: blur(50px);
}

/* Top Navigation Bar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(4, 7, 10, 0.75);
  border-bottom: 1px solid var(--card-border);
  padding: 14px 20px;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  text-decoration: none;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-glow);
  border-color: rgba(16, 185, 129, 0.3);
  font-weight: 600;
}

/* Main Container */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 20px 80px;
  position: relative;
  z-index: 1;
}

/* Header Banner Card */
.hero-card {
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  margin-bottom: 36px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle at top right, rgba(16, 185, 129, 0.15), transparent 70%);
  pointer-events: none;
}

.hero-card.terms::after {
  background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.15), transparent 70%);
}

.meta-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-primary {
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-sky {
  background: var(--sky-glow);
  color: var(--sky);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-muted {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffffff 40%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.hero-desc-box {
  background: rgba(0, 0, 0, 0.25);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 16px 20px;
}

.hero-card.terms .hero-desc-box {
  border-left-color: var(--sky);
}

.hero-desc-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: #fff;
}

.hero-desc-text {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Pillar Highlight Cards Grid */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.pillar-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.pillar-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.16);
}

.pillar-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.pillar-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.pillar-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Section Cards */
.section-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 28px 28px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s ease;
}

.section-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 700;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.section-body {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.section-body p {
  margin-bottom: 14px;
}

.section-body p:last-child {
  margin-bottom: 0;
}

.section-body ul {
  list-style: none;
  margin: 14px 0;
  padding-left: 4px;
}

.section-body li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 10px;
  line-height: 1.55;
  color: #cbd5e1;
}

.section-body li::before {
  content: '•';
  position: absolute;
  left: 8px;
  color: var(--primary);
  font-weight: bold;
}

.hero-card.terms ~ .section-card .section-body li::before {
  color: var(--sky);
}

.contact-box {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-top: 14px;
  border: 1px solid var(--card-border);
}

.contact-box a {
  color: var(--sky);
  text-decoration: none;
  font-weight: 500;
}

.contact-box a:hover {
  text-decoration: underline;
}

/* Footer */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--card-border);
  padding: 32px 20px;
  text-align: center;
  background: rgba(4, 7, 10, 0.9);
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.footer-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* Version History & Traceability Card */
.version-history-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-top: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.version-history-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.version-history-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-glow);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.hero-card.terms ~ .version-history-card .version-history-icon {
  background: var(--sky-glow);
  color: var(--sky);
}

.version-history-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.version-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.version-entry {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: border-color 0.2s ease;
}

.version-entry.current {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.03);
}

.hero-card.terms ~ .version-history-card .version-entry.current {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.03);
}

.version-entry-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.version-tag {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}

.version-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.hero-card.terms ~ .version-history-card .version-badge {
  background: var(--sky-glow);
  color: var(--sky);
  border-color: rgba(56, 189, 248, 0.3);
}

.version-date {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.version-changes {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.version-changes li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 6px;
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.5;
}

.version-changes li:last-child {
  margin-bottom: 0;
}

.version-changes li::before {
  content: '•';
  position: absolute;
  left: 6px;
  color: var(--primary);
  font-weight: bold;
}

.hero-card.terms ~ .version-history-card .version-changes li::before {
  color: var(--sky);
}

/* SPA View Transitions */
.legal-view {
  display: none;
  opacity: 0;
}

.legal-view.active {
  display: block;
  opacity: 1;
  animation: fadeInView 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInView {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 640px) {
  .hero-card {
    padding: 24px 20px;
  }
  .hero-title {
    font-size: 1.7rem;
  }
  .section-card {
    padding: 20px 18px;
  }
  .navbar {
    padding: 12px 16px;
  }
  .brand span {
    display: none;
  }
}
