/*
 * Opto Wake — Privacy & Landing Styles
 * Same chrome as the Opto site, re-tinted to the app's warm "sunrise" palette.
 */

/* Import a clean sans fallback (matches the rest of the Opto site) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* CSS Custom Properties for Theme Switching */
:root {
  /* Light Mode Colors */
  --bg-warm: #FEFCF7;
  --bg-card: #FFFFFF;
  --text-primary: #1A1D26;
  --text-secondary: #6B7280;
  /* Warm sunrise accents (from the app: #F59E4D / #FFD27A → #F59E42) */
  --accent: #C2560E;          /* link + interactive text, AA-contrast on white */
  --accent-bright: #F59E42;   /* decorative: markers, borders, glow */
  --border-color: #EDE6DA;
  --shadow-color: rgba(120, 72, 20, 0.06);

  /* Gradient — the app's hero sunrise */
  --gradient-opto: linear-gradient(135deg, #FFD27A 0%, #F59E42 100%);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-warm: #17130E;
    --bg-card: #221C15;
    --text-primary: #FDF6EC;
    --text-secondary: #B9AE9C;
    --accent: #FBB454;        /* brighter for readable contrast on dark */
    --accent-bright: #F5A623;
    --border-color: #3A3026;
    --shadow-color: rgba(0, 0, 0, 0.35);
  }
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', system-ui, sans-serif;
  background-color: var(--bg-warm);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container */
.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px var(--shadow-color);
  transition: all 0.3s ease;
}

/* Logo Styling */
.logo-link {
  text-decoration: none;
  transition: opacity 0.2s ease;
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
}

.logo-link:hover {
  opacity: 0.9;
}

.logo {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'Inter', system-ui, sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  background: var(--gradient-opto);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  user-select: none;
}

.logo-o,
.logo-pto {
  display: inline-block;
}

/* "Wake" product badge next to the Opto wordmark */
.logo-badge {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'Inter', system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #FFFFFF;
  background: var(--gradient-opto);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  user-select: none;
  align-self: center;
}

/* Navigation */
.nav {
  display: flex;
  gap: 1.5rem;
}

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

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
  background-color: var(--bg-warm);
}

/* Main Content */
.main {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.content-wrapper {
  background-color: var(--bg-card);
  border-radius: 16px;
  padding: 3rem;
  box-shadow: 0 4px 6px var(--shadow-color);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

/* ---------- Landing page ---------- */
.welcome-content {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}

.welcome-content h1 {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Rounded', 'Inter', system-ui, sans-serif;
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 0.75rem;
  background: var(--gradient-opto);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-content .subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.app-description {
  text-align: left;
  margin: 0 auto 2rem;
  max-width: 560px;
}

.app-description p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.primary-button {
  display: inline-block;
  background: var(--gradient-opto);
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 600;
  padding: 0.85rem 1.75rem;
  border-radius: 12px;
  box-shadow: 0 6px 16px var(--shadow-color);
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.primary-button:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.secondary-button {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 0.85rem 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.secondary-button:hover {
  border-color: var(--accent-bright);
}

.app-store-info {
  display: inline-flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.app-store-info p {
  margin: 0;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 1rem;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--accent-bright);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Privacy Policy Content Styles */
.privacy-content {
  display: none; /* Hidden until loaded */
}

.privacy-content.loaded {
  display: block;
  animation: fadeIn 0.5s ease-in;
}

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

/* Typography */
.privacy-content h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: var(--gradient-opto);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.privacy-content h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2.5rem 0 1rem 0;
  line-height: 1.3;
}

.privacy-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2rem 0 0.75rem 0;
}

.privacy-content p {
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  line-height: 1.7;
}

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

.privacy-content em {
  font-style: italic;
  color: var(--text-secondary);
}

/* Links */
.privacy-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.2s ease;
}

.privacy-content a:hover {
  border-bottom-color: var(--accent);
}

/* Lists */
.privacy-content ul,
.privacy-content ol {
  margin: 1rem 0 1.5rem 1.5rem;
  padding-left: 0;
}

.privacy-content li {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  line-height: 1.6;
}

.privacy-content li::marker {
  color: var(--accent-bright);
}

/* Blockquotes */
.privacy-content blockquote {
  border-left: 4px solid var(--accent-bright);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--text-secondary);
}

/* Code blocks */
.privacy-content code {
  background-color: var(--bg-warm);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
}

.privacy-content pre {
  background-color: var(--bg-warm);
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
}

.privacy-content pre code {
  background: none;
  padding: 0;
  border: none;
}

/* Special styling for metadata */
.privacy-content p:first-of-type {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

/* Error / 404 message */
.error-message {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.error-message h1,
.error-message h2 {
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.retry-button {
  display: inline-block;
  background: var(--gradient-opto);
  border: none;
  color: #FFFFFF;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.retry-button:hover {
  opacity: 0.9;
}

.header-anchor {
  opacity: 0;
  margin-left: 0.5rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: normal;
  transition: opacity 0.2s ease;
}

h2:hover .header-anchor,
h3:hover .header-anchor,
h4:hover .header-anchor {
  opacity: 1;
}

.emoji {
  font-style: normal;
  font-weight: normal;
}

/* Footer */
.footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-content p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.footer-link {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.footer-link:hover {
  opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
    position: relative;
  }

  .logo {
    font-size: 2rem;
  }

  .nav {
    gap: 1rem;
  }

  .main {
    padding: 1rem;
  }

  .content-wrapper {
    padding: 1.5rem;
    border-radius: 12px;
  }

  .welcome-content h1 {
    font-size: 2.1rem;
  }

  .privacy-content h1 {
    font-size: 2rem;
  }

  .privacy-content h2 {
    font-size: 1.5rem;
  }

  .privacy-content h3 {
    font-size: 1.125rem;
  }

  .footer {
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 1.75rem;
  }

  .content-wrapper {
    padding: 1rem;
  }

  .welcome-content h1 {
    font-size: 1.85rem;
  }

  .privacy-content h1 {
    font-size: 1.75rem;
  }

  .privacy-content h2 {
    font-size: 1.375rem;
  }

  .privacy-content ul,
  .privacy-content ol {
    margin-left: 1rem;
  }
}

/* Smooth transitions for theme changes */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
