/* =========================================
   Material Design 3 Theme
   ========================================= */

:root {
  /* M3 Color Tokens */
  --md-sys-color-primary: #6366f1;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #e0e0ff;
  --md-sys-color-on-primary-container: #001b3e;
  --md-sys-color-secondary: #8b5cf6;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #eedeff;
  --md-sys-color-on-secondary-container: #1d0064;
  --md-sys-color-tertiary: #06b6d4;
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-error: #b3261e;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-surface: #fffbff;
  --md-sys-color-on-surface: #1b1b1f;
  --md-sys-color-surface-variant: #f2f0f5;
  --md-sys-color-on-surface-variant: #49454f;
  --md-sys-color-outline: #79747e;
  --md-sys-color-outline-variant: #cac4d0;
  --md-sys-color-background: #fffbff;
  --md-sys-color-on-background: #1b1b1f;
  --md-sys-color-surface-container: #f3edf7;
  --md-sys-color-surface-container-high: #ece6f0;

  /* M3 Shape */
  --md-sys-shape-corner-xs: 4px;
  --md-sys-shape-corner-sm: 8px;
  --md-sys-shape-corner-md: 12px;
  --md-sys-shape-corner-lg: 16px;
  --md-sys-shape-corner-xl: 28px;
  --md-sys-shape-corner-full: 9999px;

  /* M3 Elevation */
  --md-sys-elevation-0: none;
  --md-sys-elevation-1: 0px 1px 3px 1px rgba(0,0,0,0.15), 0px 1px 2px rgba(0,0,0,0.3);
  --md-sys-elevation-2: 0px 2px 6px 2px rgba(0,0,0,0.15), 0px 1px 2px rgba(0,0,0,0.3);
  --md-sys-elevation-3: 0px 4px 8px 3px rgba(0,0,0,0.15), 0px 1px 3px rgba(0,0,0,0.3);
}

/* =========================================
   Reset & Base
   ========================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--md-sys-color-background);
  color: var(--md-sys-color-on-surface);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* =========================================
   Top App Bar (M3 Small)
   ========================================= */

.md3-top-app-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 251, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.md3-top-app-bar__row {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.md3-top-app-bar__section {
  display: flex;
  align-items: center;
}

.md3-top-app-bar__section-start { gap: 12px; }
.md3-top-app-bar__section-end { margin-left: auto; }

.md3-top-app-bar__icon {
  font-size: 28px;
  color: var(--md-sys-color-primary);
}

.md3-top-app-bar__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  letter-spacing: -0.01em;
}

.md3-top-app-bar__nav { gap: 4px; }

.md3-nav-link {
  padding: 8px 16px;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  transition: all 0.2s ease;
}

.md3-nav-link:hover {
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
}

.md3-icon-button {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: var(--md-sys-shape-corner-full);
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-surface);
  transition: background 0.2s;
}

.md3-icon-button:hover { background: var(--md-sys-color-surface-container); }

.md3-icon-button .material-symbols-outlined { font-size: 24px; }

/* Dropdown (mobile) */
.md3-top-app-bar__dropdown {
  display: none;
  flex-direction: column;
  padding: 8px;
  gap: 2px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
}

.md3-top-app-bar__dropdown.open { display: flex; }

.md3-dropdown-item {
  padding: 12px 16px;
  border-radius: var(--md-sys-shape-corner-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  transition: background 0.2s;
}

.md3-dropdown-item:hover { background: var(--md-sys-color-surface-container); }

/* =========================================
   Hero
   ========================================= */

.md3-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 48px;
  background: linear-gradient(160deg, #6366f1 0%, #8b5cf6 40%, #a78bfa 70%, #c4b5fd 100%);
  position: relative;
  overflow: hidden;
}

.md3-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(255,255,255,0.15) 0%, transparent 60%);
}

.md3-hero__content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  text-align: center;
}

.md3-hero__title {
  font-size: 3.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.md3-hero__subtitle {
  font-size: 1.25rem;
  color: rgba(255,255,255,0.85);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.md3-hero__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* =========================================
   Buttons (M3)
   ========================================= */

.md3-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  height: 40px;
  border-radius: var(--md-sys-shape-corner-full);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.md3-button--filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-sys-elevation-1);
}

.md3-button--filled:hover {
  box-shadow: var(--md-sys-elevation-2);
  background: color-mix(in srgb, var(--md-sys-color-primary) 90%, #000);
}

.md3-hero .md3-button--filled {
  background: #fff;
  color: var(--md-sys-color-primary);
  box-shadow: var(--md-sys-elevation-2);
}

.md3-hero .md3-button--filled:hover {
  background: #f5f5f5;
  box-shadow: var(--md-sys-elevation-3);
}

.md3-hero .md3-button--outlined {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.6);
}

.md3-hero .md3-button--outlined:hover {
  border-color: #fff;
  background: rgba(255,255,255,0.1);
}

.md3-button--outlined {
  background: transparent;
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
}

.md3-button--outlined:hover { background: var(--md-sys-color-surface-container); }

.md3-button--tonal {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.md3-button--tonal:hover {
  background: color-mix(in srgb, var(--md-sys-color-secondary-container) 90%, #000);
}

.md3-button--full { width: 100%; justify-content: center; }

.md3-button__icon { font-size: 18px; }

/* =========================================
   Sections
   ========================================= */

.md3-section {
  padding: 80px 24px;
}

.md3-section--alt {
  background: var(--md-sys-color-surface-container);
}

.md3-container {
  max-width: 1200px;
  margin: 0 auto;
}

.md3-container--narrow {
  max-width: 700px;
}

.md3-section__title {
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
  color: var(--md-sys-color-on-surface);
  letter-spacing: -0.01em;
}

.md3-section__subtitle {
  font-size: 1rem;
  color: var(--md-sys-color-on-surface-variant);
  text-align: center;
  margin-bottom: 3rem;
}

.md3-section__text {
  font-size: 1.05rem;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.7;
  margin-bottom: 1rem;
}

/* =========================================
   Grid
   ========================================= */

.md3-grid {
  display: grid;
  gap: 24px;
}

.md3-grid--3 { grid-template-columns: repeat(3, 1fr); }
.md3-grid--2 { grid-template-columns: repeat(2, 1fr); }

/* =========================================
   Cards (M3)
   ========================================= */

.md3-card {
  border-radius: var(--md-sys-shape-corner-lg);
  overflow: hidden;
  transition: all 0.3s ease;
}

.md3-card--elevated {
  background: var(--md-sys-color-surface);
  box-shadow: var(--md-sys-elevation-1);
}

.md3-card--elevated:hover {
  box-shadow: var(--md-sys-elevation-2);
  transform: translateY(-2px);
}

.md3-card--outlined {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.md3-card--highlighted {
  position: relative;
  transform: scale(1.05);
  z-index: 1;
  box-shadow: 0 0 0 2px var(--md-sys-color-primary), var(--md-sys-elevation-3);
}

.md3-card--highlighted:hover {
  transform: scale(1.05) translateY(-2px);
}

.md3-card__content {
  padding: 32px 24px;
}

.md3-card__content--center {
  text-align: center;
}

.md3-card__icon {
  font-size: 2.5rem;
  color: var(--md-sys-color-primary);
  margin-bottom: 16px;
  display: inline-block;
}

.md3-card__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--md-sys-color-on-surface);
}

.md3-card__text {
  font-size: 0.938rem;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.6;
}

.md3-card__price {
  margin: 16px 0;
}

.md3-card__price-amount {
  font-size: 2rem;
  font-weight: 700;
  color: var(--md-sys-color-primary);
}

.md3-card__price-period {
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface-variant);
}

.md3-card__list {
  list-style: none;
  text-align: left;
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.md3-card__list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface);
}

.md3-card__list-icon {
  font-size: 18px;
  color: var(--md-sys-color-primary);
}

/* =========================================
   Chips
   ========================================= */

.md3-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 2rem;
}

.md3-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
}

.md3-chip__icon { font-size: 16px; }

/* =========================================
   Contact
   ========================================= */

.md3-contact-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.md3-inline-link {
  color: var(--md-sys-color-primary);
  font-weight: 500;
}

.md3-inline-link:hover { text-decoration: underline; }

/* =========================================
   Footer (M3)
   ========================================= */

.md3-footer {
  background: var(--md-sys-color-surface-container);
  border-top: 1px solid var(--md-sys-color-outline-variant);
  padding: 48px 24px 24px;
}

.md3-footer__content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.md3-footer__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.md3-footer__text {
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.6;
}

.md3-footer__link {
  display: block;
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface-variant);
  padding: 4px 0;
  transition: color 0.2s;
}

.md3-footer__link:hover { color: var(--md-sys-color-primary); }

.md3-footer__bottom {
  border-top: 1px solid var(--md-sys-color-outline-variant);
  padding-top: 16px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--md-sys-color-on-surface-variant);
}

/* =========================================
   Sub-page styles (legal, install pages)
   ========================================= */

.md3-page {
  padding: 88px 24px 48px;
  min-height: 100vh;
}

.md3-page__container {
  max-width: 900px;
  margin: 0 auto;
  background: var(--md-sys-color-surface);
  padding: 40px 48px;
  border-radius: var(--md-sys-shape-corner-xl);
  box-shadow: var(--md-sys-elevation-1);
}

.md3-page__title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 2rem;
  color: var(--md-sys-color-primary);
}

.md3-page h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--md-sys-color-on-surface);
}

.md3-page h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--md-sys-color-on-surface);
}

.md3-page p {
  line-height: 1.7;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 0.75rem;
}

.md3-page ul, .md3-page ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.md3-page li {
  margin-bottom: 0.5rem;
  color: var(--md-sys-color-on-surface-variant);
  line-height: 1.6;
}

.md3-page code {
  background: var(--md-sys-color-surface-container);
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-corner-xs);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.875rem;
}

.md3-page pre {
  background: var(--md-sys-color-surface-container);
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-sm);
  overflow-x: auto;
  margin: 1rem 0;
}

.md3-page pre code {
  background: none;
  padding: 0;
}

.md3-page .md3-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--md-sys-color-primary);
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.md3-page .md3-back-link:hover { text-decoration: underline; }

.md3-page .md3-last-updated {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  font-size: 0.8125rem;
  color: var(--md-sys-color-on-surface-variant);
}

.md3-page .md3-note-box {
  background: var(--md-sys-color-primary-container);
  border-radius: var(--md-sys-shape-corner-md);
  padding: 16px 20px;
  margin: 1.5rem 0;
  color: var(--md-sys-color-on-primary-container);
  font-size: 0.875rem;
}

.md3-page .md3-warning-box {
  background: #fee2e2;
  border-radius: var(--md-sys-shape-corner-md);
  padding: 16px 20px;
  margin: 1.5rem 0;
  color: #991b1b;
  font-size: 0.875rem;
}

.md3-page .md3-platform-section {
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.md3-page .md3-platform-section h2 {
  margin-top: 0.5rem;
}

/* =========================================
   Responsive
   ========================================= */

@media (max-width: 1024px) {
  .md3-grid--3 { grid-template-columns: repeat(2, 1fr); }
  .md3-card--highlighted { transform: none; }
  .md3-card--highlighted:hover { transform: translateY(-2px); }
  .md3-footer__content { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .md3-top-app-bar__nav { display: none; }
  .md3-icon-button { display: flex; }

  .md3-hero__title { font-size: 2.5rem; }
  .md3-hero__subtitle { font-size: 1.05rem; }

  .md3-grid--3 { grid-template-columns: 1fr; }
  .md3-grid--2 { grid-template-columns: 1fr; }

  .md3-section { padding: 56px 16px; }

  .md3-page__container { padding: 24px 16px; }

  .md3-footer__content { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .md3-hero__title { font-size: 2rem; }
  .md3-hero__actions { flex-direction: column; align-items: center; }
  .md3-hero .md3-button { width: 100%; justify-content: center; }
}
