:root {
  --bg: #FAF8F5;
  --bg-warm: #F5F1EB;
  --text: #2C2A26;
  --text-secondary: #6B6560;
  --accent: #B8860B;
  --accent-muted: #D4A84B;
  --thread: #C9B896;
  --border: #E5DFD5;
  --warning: #C4650A;
  --warning-bg: #FEF3E7;
  --success: #2E7D4A;
  --success-bg: #E8F5EC;
}

:root[data-theme="dark"],
body.dark-mode {
  --bg: #2C2A26;
  --bg-warm: #3A3733;
  --text: #FAF8F5;
  --text-secondary: #B8B3AD;
  --accent: #D4A84B;
  --accent-muted: #B8860B;
  --thread: #96744A;
  --border: #4A4540;
  --warning: #D4A84B;
  --warning-bg: #3A3733;
  --success: #74C28A;
  --success-bg: #1f2a22;
}

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

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

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

nav {
  padding: 1.5rem 4rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  gap: 1rem;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-mark {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  display: inline-block;
  vertical-align: middle;
  border-radius: 50%;
  object-fit: contain;
}

.nav-center {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.theme-toggle.mobile-only { display: none; }

.theme-toggle input {
  width: 36px;
  height: 20px;
  appearance: none;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
  transform: translateY(0.2rem);
}

.theme-toggle input::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.theme-toggle input:checked {
  background: var(--accent);
}

.theme-toggle input:checked::before {
  transform: translateX(16px);
}

.logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-dropdown {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.heading-line {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25em;
  margin: 0.2rem 0;
  font-weight: 600;
}

.heading-1 {
  font-size: 2.1em;
}

.heading-2 {
  font-size: 1.8em;
}

.heading-3 {
  font-size: 1.5em;
}

.heading-4 {
  font-size: 1.35em;
  margin-bottom: 0.15rem;
}

.auth-buttons {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  transition: all 0.2s;
}

.auth-buttons.collapsed {
  display: none !important;
}

.auth-toggle {
  display: none;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.auth-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.auth-provider-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-button {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

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

.user-menu {
  display: none;
  position: relative;
}

.user-menu[open] {
  display: block;
}

.user-menu summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.user-name {
  font-size: 0.9rem;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  min-width: 160px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  z-index: 10;
}

.user-dropdown button {
  width: 100%;
  background: none;
  border: none;
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text);
}

.user-dropdown button:hover {
  background: var(--bg-warm);
}

.share-cta {
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.desktop-only { display: inline; }
.mobile-only { display: none; }

.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
}

.btn-primary:hover {
  background: #a5770a;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
}

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

.mobile-menu-button {
  display: none;
}

/* Mobile styles */
@media (max-width: 600px) {
  nav {
    padding: 1rem 1.5rem;
  }
  nav { position: relative; }
  .desktop-only { display: none; }
  .mobile-only { display: inline-flex; }
  .theme-toggle.desktop-only { display: none; }
  .theme-toggle.mobile-only { display: inline-flex; }

  .mobile-menu-button {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.4rem 0.5rem;
    cursor: pointer;
  }

  .mobile-menu-button span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
  }

  .nav-right {
    margin-left: auto;
  }

  .nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    background: var(--bg);
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  z-index: 20;
}

.nav-dropdown.active {
  display: flex;
}

  .nav-links,
  .nav-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: static;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .nav-links a {
    margin: 0;
  }

  .auth-buttons {
    flex-direction: column;
    width: 100%;
  }
  .auth-provider-buttons {
    flex-direction: column;
    width: 100%;
  }
  .auth-provider-buttons .auth-button {
    width: 100%;
  }

  .nav-dropdown .theme-toggle {
    margin-top: 0.6rem;
  }
  .auth-toggle {
    display: inline-flex;
  }

  .btn {
    width: 100%;
    justify-content: center;
    padding: 0.55rem 0.9rem;
    border-radius: 12px;
  }

  .nav-links .btn,
  .nav-actions .btn {
    width: 100%;
  }
}
