/* ============================================
   SoulScribe Legal Site — Design System
   ============================================ */

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

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
  --color-brand: #8B5A3C;
  --color-brand-dark: #6B4226;
  --color-brand-light: #A67B5B;
  --color-brand-bg: #FFF8ED;

  --color-bg: #FAF9F7;
  --color-card: #FFFFFF;
  --color-border: #F0EBE5;
  --color-border-light: #F5F2EF;

  --color-text-primary: #1A1A1A;
  --color-text-secondary: #6B7280;
  --color-text-muted: #9CA3AF;

  --color-success: #10B981;
  --color-error: #DC2626;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text-secondary);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  color: var(--color-text-primary);
  line-height: 1.3;
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 40px;
  margin-bottom: 16px;
  padding-left: 16px;
  border-left: 3px solid var(--color-brand);
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 10px;
  color: var(--color-text-primary);
}

p {
  margin-bottom: 16px;
  color: var(--color-text-secondary);
}

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

a:hover {
  color: var(--color-brand-dark);
}

ul, ol {
  margin-bottom: 16px;
  padding-left: 20px;
}

li {
  margin-bottom: 8px;
  color: var(--color-text-secondary);
  padding-left: 4px;
}

li::marker {
  color: var(--color-brand-light);
}

strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

/* ============================================
   Navigation — Sticky + Frosted Glass
   ============================================ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 56px;
}

nav a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 16px 18px;
  transition: color var(--transition), border-color var(--transition);
  border-bottom: 2px solid transparent;
  line-height: 1;
}

nav a:hover {
  color: var(--color-brand);
}

nav a.active {
  color: var(--color-brand);
  border-bottom-color: var(--color-brand);
}

/* ============================================
   Header / Hero
   ============================================ */
header {
  text-align: center;
  padding: 48px 24px 40px;
  background: linear-gradient(135deg, #8B5A3C 0%, #A67B5B 50%, #6B4226 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: radial-gradient(ellipse at 30% 0%, rgba(255,255,255,0.12) 0%, transparent 70%);
  pointer-events: none;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: white;
  position: relative;
}

header p {
  font-size: 1rem;
  opacity: 0.9;
  color: rgba(255,255,255,0.9);
  position: relative;
  margin-bottom: 0;
}

.hero {
  text-align: center;
  padding: 80px 24px 72px;
  background: linear-gradient(135deg, #8B5A3C 0%, #A67B5B 50%, #6B4226 100%);
  color: white;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: radial-gradient(ellipse at 30% 0%, rgba(255,255,255,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  color: white;
  font-size: 2.75rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.03em;
  position: relative;
}

.hero p {
  color: rgba(255,255,255,0.9);
  font-size: 1.15rem;
  position: relative;
  margin-bottom: 0;
}

.hero .subtitle {
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
  margin-top: 8px;
}

/* App Store Badge */
.app-store-badge {
  display: inline-block;
  margin-top: 28px;
  position: relative;
  transition: transform var(--transition), opacity var(--transition);
  text-decoration: none;
}

.app-store-badge svg {
  width: 180px;
  height: 60px;
}

.app-store-badge:hover {
  transform: scale(1.04);
  opacity: 0.9;
}

/* ============================================
   Containers
   ============================================ */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px;
}

/* ============================================
   Effective Date Badge
   ============================================ */
.effective-date {
  display: inline-block;
  color: var(--color-brand);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 28px;
  padding: 6px 14px;
  background: var(--color-brand-bg);
  border-radius: var(--radius-sm);
}

/* ============================================
   Feature Cards (Landing Page)
   ============================================ */
.features-section {
  max-width: 900px;
  margin: -40px auto 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  position: relative;
  z-index: 10;
}

.feature-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border-light);
  transition: transform var(--transition), box-shadow var(--transition);
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.feature-card .icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: var(--color-brand-bg);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-card .icon svg {
  width: 28px;
  height: 28px;
  color: var(--color-brand);
  stroke: var(--color-brand);
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--color-text-primary);
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ============================================
   Link Cards Section
   ============================================ */
.links-section {
  max-width: 900px;
  margin: 48px auto 60px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.links-section-title {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 24px;
  grid-column: 1 / -1;
  border: none;
  padding-left: 0;
}

.link-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.link-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.link-card .card-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  background: var(--color-brand-bg);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.link-card .card-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--color-brand);
}

.link-card h2 {
  border: none;
  margin: 0 0 6px;
  padding: 0;
  font-size: 1.1rem;
  color: var(--color-brand);
}

.link-card p {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ============================================
   Contact Box / Callout
   ============================================ */
.contact-box {
  background: var(--color-brand-bg);
  border: 1px solid rgba(139, 90, 60, 0.15);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-top: 40px;
}

.contact-box h2 {
  border: none;
  margin-top: 0;
  padding-left: 0;
  color: var(--color-brand);
  font-size: 1.2rem;
}

/* ============================================
   Legal Page Layout (with TOC)
   ============================================ */
.legal-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 48px;
  align-items: start;
}

.legal-layout .legal-content {
  max-width: 900px;
}

.legal-layout .legal-content h2:first-of-type {
  margin-top: 0;
}

/* Table of Contents Sidebar */
.toc-sidebar {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 16px;
}

.toc-sidebar h4 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.toc-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-sidebar li {
  margin-bottom: 2px;
  padding: 0;
}

.toc-sidebar a {
  display: block;
  font-size: 0.84rem;
  font-weight: 400;
  color: var(--color-text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
}

.toc-sidebar a:hover {
  color: var(--color-brand);
  background: var(--color-brand-bg);
}

.toc-sidebar a.active {
  color: var(--color-brand);
  border-left-color: var(--color-brand);
  background: var(--color-brand-bg);
  font-weight: 500;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-brand);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--transition), transform var(--transition), background var(--transition);
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--color-brand-dark);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* ============================================
   Forms (Support Page)
   ============================================ */
.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 6px;
}

.form-group label .required {
  color: var(--color-error);
  margin-left: 2px;
}

.form-group .helper-text {
  font-size: 0.84rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-family: var(--font-family);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-card);
  color: var(--color-text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-text-muted);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(139, 90, 60, 0.1);
}

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

/* Issue Tags */
.issue-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.issue-tag {
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  background: var(--color-card);
  font-size: 0.87rem;
  font-family: var(--font-family);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.issue-tag:hover {
  border-color: var(--color-brand-light);
  color: var(--color-brand);
  background: var(--color-brand-bg);
}

.issue-tag.selected {
  background: var(--color-brand);
  color: #fff;
  border-color: var(--color-brand);
}

/* Submit Button */
.submit-btn {
  display: block;
  width: 100%;
  padding: 16px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-family);
  color: #fff;
  background: var(--color-brand);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition), transform 0.1s ease;
}

.submit-btn:hover {
  background: var(--color-brand-dark);
}

.submit-btn:active {
  transform: scale(0.985);
}

.submit-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Success Message */
.success-message {
  text-align: center;
  padding: 60px 20px;
}

.success-message .checkmark {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  animation: scaleIn 0.4s ease;
}

.success-message .checkmark svg {
  width: 40px;
  height: 40px;
  color: white;
  stroke: white;
  stroke-width: 2.5;
}

@keyframes scaleIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.success-message h2 {
  border: none;
  margin-top: 0;
  padding-left: 0;
  font-size: 1.5rem;
}

.success-message p {
  color: var(--color-text-secondary);
  font-size: 1rem;
}

.form-footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 16px;
}

.hidden {
  display: none;
}

/* ============================================
   FAQ Accordion
   ============================================ */
.faq-section {
  margin-bottom: 48px;
}

.faq-section h2 {
  border: none;
  padding-left: 0;
  text-align: center;
  margin-bottom: 24px;
}

.faq-item {
  background: var(--color-card);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.faq-item:hover {
  box-shadow: var(--shadow-sm);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 18px 20px;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--color-text-primary);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.faq-question svg {
  width: 18px;
  height: 18px;
  stroke: var(--color-text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
  margin-left: 12px;
}

.faq-item.open .faq-question svg {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-answer p {
  padding: 0 20px 18px;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.65;
}

/* ============================================
   Footer
   ============================================ */
footer {
  border-top: 1px solid var(--color-border);
  margin-top: 0;
  padding: 40px 24px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

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

/* Simple footer fallback */
footer:not(:has(.footer-inner)) {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* ============================================
   Responsive — Tablet
   ============================================ */
@media (max-width: 768px) {
  .hero {
    padding: 60px 20px 56px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .features-section {
    grid-template-columns: 1fr;
    margin-top: -24px;
    gap: 14px;
  }

  .feature-card {
    display: flex;
    align-items: center;
    text-align: left;
    padding: 20px 24px;
    gap: 16px;
  }

  .feature-card .icon {
    margin: 0;
    flex-shrink: 0;
  }

  .feature-card h3,
  .feature-card p {
    margin: 0;
  }

  .links-section {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 36px;
  }

  .legal-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }

  .toc-sidebar {
    position: static;
    max-height: none;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-card);
  }

  .toc-sidebar ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .toc-sidebar a {
    font-size: 0.8rem;
    padding: 5px 10px;
    border-left: none;
    border-radius: 100px;
    border: 1px solid var(--color-border);
  }

  .toc-sidebar a.active {
    border-color: var(--color-brand);
    border-left-color: var(--color-brand);
  }

  .legal-layout .legal-content {
    padding: 32px 24px;
  }

  .container {
    padding: 32px 20px;
  }

  nav {
    gap: 0;
    padding: 0 12px;
  }

  nav a {
    padding: 16px 12px;
    font-size: 0.84rem;
  }

  .footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

/* ============================================
   Responsive — Mobile
   ============================================ */
@media (max-width: 480px) {
  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero {
    padding: 48px 16px 44px;
  }

  header {
    padding: 36px 16px 32px;
  }

  nav a {
    padding: 14px 8px;
    font-size: 0.8rem;
  }

  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
  }
}
