/* Stone & Spark design tokens */
:root {
  --foundry-coral: #E07A3F;
  --foundry-coral-dark: #C95F24;
  --foundry-ink: #0C1A20;
  --foundry-charcoal: #1E3446;
  --foundry-slate: #475569;
  --foundry-warm: #F3F1EA;
  --foundry-white: #FFFFFF;
}

.bg-ink { background-color: var(--foundry-ink); }
.bg-warm { background-color: var(--foundry-warm); }
.bg-coral-500 { background-color: var(--foundry-coral); }
.bg-coral-600 { background-color: var(--foundry-coral-dark); }
.bg-coral-50 { background-color: #FFF1F3; }
.text-ink { color: var(--foundry-ink); }
.text-slatebrand { color: var(--foundry-slate); }
.text-coral-500 { color: var(--foundry-coral); }
.text-white\/62 { color: rgba(255, 255, 255, 0.62); }
.text-white\/36 { color: rgba(255, 255, 255, 0.36); }
.border-ink\/10 { border-color: rgba(15, 27, 42, 0.1); }
.rounded-foundry { border-radius: 8px; }
.bg-white\/92 { background-color: rgba(255, 255, 255, 0.92); }
.bg-white\/96 { background-color: rgba(255, 255, 255, 0.96); }
.hover\:text-coral-500:hover { color: var(--foundry-coral); }
.hover\:bg-coral-600:hover { background-color: var(--foundry-coral-dark); }

.foundry-page {
  background: var(--foundry-warm);
  color: var(--foundry-ink);
  font-family: 'Inter', system-ui, sans-serif;
}

.foundry-page h1,
.foundry-page h2,
.foundry-page h3,
.foundry-page .font-display {
  font-family: 'Clash Grotesk', 'Space Grotesk', 'Inter', system-ui, sans-serif;
  letter-spacing: 0;
}

.foundry-page-hero {
  background:
    linear-gradient(90deg, rgba(15, 27, 42, 0.92), rgba(15, 27, 42, 0.68)),
    url('../images/Portland_panorama3.jpg');
  background-position: center;
  background-size: cover;
  color: #fff;
}

.foundry-page-section {
  background: var(--foundry-warm);
}

.foundry-page-card {
  background: #fff;
  border: 1px solid rgba(15, 27, 42, 0.12);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(15, 27, 42, 0.06);
}

.foundry-page-card.soft {
  background: rgba(255, 255, 255, 0.74);
}

.foundry-page-icon {
  align-items: center;
  background: #FFF1F3;
  border: 1px solid rgba(255, 90, 107, 0.22);
  border-radius: 8px;
  color: var(--foundry-coral);
  display: inline-flex;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.foundry-page-icon svg {
  height: 24px;
  width: 24px;
}

.foundry-page-badge {
  background: #FFF1F3;
  border: 1px solid rgba(255, 90, 107, 0.2);
  border-radius: 9999px;
  color: var(--foundry-coral);
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 0.35rem 0.75rem;
  text-transform: uppercase;
}

.foundry-page-dark {
  background: var(--foundry-ink);
  color: #fff;
}

.foundry-page-link {
  color: var(--foundry-coral);
  font-weight: 700;
}

.foundry-page-link:hover {
  color: var(--foundry-coral-dark);
}

.foundry-step-number {
  align-items: center;
  background: var(--foundry-coral);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  font-weight: 700;
  height: 40px;
  justify-content: center;
  min-width: 40px;
}

html[data-theme="dark"] .foundry-page {
  background: #0F1B2A;
  color: #F8FAFC;
}

html[data-theme="dark"] .foundry-page-section {
  background: #0F1B2A;
}

html[data-theme="dark"] .foundry-page-card,
html[data-theme="dark"] .foundry-page-card.soft {
  background: #111827;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .foundry-page-icon,
html[data-theme="dark"] .foundry-page-badge {
  background: rgba(255, 90, 107, 0.12);
  border-color: rgba(255, 90, 107, 0.26);
}

.foundry-theme-toggle {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(15, 27, 42, 0.16);
  border-radius: 8px;
  color: var(--foundry-ink);
  display: inline-flex;
  height: 40px;
  justify-content: center;
  width: 40px;
}

html[data-theme="dark"] .foundry-logo-mark {
  background: #fff;
  border-radius: 8px;
  box-sizing: content-box;
  padding: 0.35rem 0.6rem;
}

html[data-theme="dark"] .brand-logo-card {
  background: #fff !important;
}

.foundry-theme-toggle .sun-icon,
html[data-theme="light"] .foundry-theme-toggle .moon-icon {
  display: none;
}

html[data-theme="light"] .foundry-theme-toggle .sun-icon {
  display: block;
}

html[data-theme="dark"] body {
  background: #0F1B2A;
  color: #F8FAFC;
}

html[data-theme="dark"] #site-nav {
  background: rgba(15, 27, 42, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] #mobile-nav,
html[data-theme="dark"] .card,
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] footer.bg-ink {
  background-color: #111827 !important;
}

html[data-theme="dark"] img.brand-logo-card.bg-white {
  background: #fff !important;
}

html[data-theme="dark"] .bg-warm {
  background-color: #0D1117 !important;
}

html[data-theme="dark"] .text-ink {
  color: #F8FAFC !important;
}

html[data-theme="dark"] .text-slatebrand {
  color: #A3A9B3 !important;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .foundry-theme-toggle {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .foundry-theme-toggle {
  background: #111827;
  color: #F8FAFC;
}

/* Shared navigation fallbacks: keep links usable if Tailwind utilities are unavailable. */
#desktop-nav {
  align-items: center;
  display: none;
  gap: 1rem;
}

#mobile-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  display: inline-flex;
  height: 40px;
  justify-content: center;
  width: 40px;
}

#mobile-nav.hidden {
  display: none;
}

#mobile-nav:not(.hidden) {
  display: block;
}

@media (min-width: 1024px) {
  #desktop-nav {
    display: flex;
  }

  #mobile-toggle,
  #mobile-nav {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  #mobile-nav {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

html[data-theme="dark"] .btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  color: #F8FAFC;
}

/* Custom CSS for Buildly Labs Foundry */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

/* Partner logo animations */
.partner-logo {
  transition: all 0.3s ease;
}

.partner-logo:hover {
  transform: scale(1.1);
}

/* Custom gradient backgrounds */
.gradient-hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-cta {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Form styles */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(15, 27, 42, 0.16);
  border-radius: 8px;
  transition: all 0.3s ease;
  background: #fff;
  color: var(--foundry-ink);
}

.form-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 90, 107, 0.18);
  border-color: var(--foundry-coral);
}

.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(15, 27, 42, 0.16);
  border-radius: 8px;
  transition: all 0.3s ease;
  resize: vertical;
  min-height: 8rem;
  background: #fff;
  color: var(--foundry-ink);
}

.form-textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 90, 107, 0.18);
  border-color: var(--foundry-coral);
}

.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(15, 27, 42, 0.16);
  border-radius: 8px;
  transition: all 0.3s ease;
  background-color: white;
  color: var(--foundry-ink);
}

.form-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 90, 107, 0.18);
  border-color: var(--foundry-coral);
}

.btn-primary {
  background-color: #2563eb;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-secondary {
  background-color: #e5e7eb;
  color: #374151;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background-color: #d1d5db;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid white;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Success/Error messages */
.alert-success {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.alert-error {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

/* Form-specific styles */
.step {
  display: none;
}

.step[hidden],
#prevBtn[hidden],
#nextBtn[hidden],
#submitBtn[hidden] {
  display: none !important;
}

.step.active {
  display: block;
  animation: fadeInUp 0.5s ease-out;
}

.step-indicator {
  position: relative;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
}

.step-indicator.active {
  background-color: var(--foundry-coral);
  color: white;
}

.step-indicator.completed {
  background-color: #047857;
  color: white;
}

.step-indicator.completed::after {
  content: '✓';
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
}

.progress-bar {
  transition: width 0.3s ease;
}

.index-choice {
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 27, 42, 0.12);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 0.75rem;
  line-height: 1.5;
  padding: 0.85rem 1rem;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.index-choice:hover {
  background: #fff;
  border-color: rgba(255, 90, 107, 0.45);
  transform: translateY(-1px);
}

.index-choice input {
  accent-color: var(--foundry-coral);
  flex: 0 0 auto;
  margin-top: 0.22rem;
}

.index-question-group.border-red-500,
#quarterlyRoomForm fieldset.border-red-500,
.form-input.border-red-500,
.form-textarea.border-red-500,
.form-select.border-red-500 {
  border-color: #dc2626 !important;
}

#quarterlyRoomForm fieldset.border-red-500 {
  outline: 1px solid #dc2626;
  outline-offset: 3px;
}

.error-message {
  color: #dc2626;
  font-weight: 700;
}

html[data-theme="dark"] .index-form-shell,
html[data-theme="dark"] .form-input,
html[data-theme="dark"] .form-textarea,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .index-choice {
  background: #111827;
  border-color: rgba(255, 255, 255, 0.12);
  color: #F8FAFC;
}

html[data-theme="dark"] .index-choice:hover {
  border-color: rgba(255, 90, 107, 0.5);
}

html[data-theme="dark"] .form-input::placeholder,
html[data-theme="dark"] .form-textarea::placeholder {
  color: rgba(248, 250, 252, 0.5);
}

html[data-theme="dark"] .alert-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #A7F3D0;
}

html[data-theme="dark"] .alert-error {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(248, 113, 113, 0.3);
  color: #FCA5A5;
}

/* File input styling */
input[type="file"] {
  padding: 0.5rem;
  border: 2px dashed #d1d5db;
  border-radius: 0.5rem;
  background-color: #f9fafb;
  transition: all 0.3s ease;
}

input[type="file"]:hover {
  border-color: #3b82f6;
  background-color: #eff6ff;
}

input[type="file"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Enhanced button styles */
.btn-primary:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.btn-secondary:disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

/* First City Foundry page-level button overrides */
.foundry-page .btn-primary {
  align-items: center;
  background: var(--foundry-coral) !important;
  border-radius: 8px;
  color: #fff !important;
  display: inline-flex;
  font-weight: 700;
  gap: 0.5rem;
  justify-content: center;
  min-height: 44px;
  padding: 0.75rem 1.1rem;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.foundry-page .btn-primary:hover {
  background: var(--foundry-coral-dark) !important;
  transform: translateY(-1px);
}

.foundry-page .btn-ghost {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  font-weight: 700;
  gap: 0.5rem;
  justify-content: center;
  min-height: 44px;
  padding: 0.75rem 1.1rem;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .hero-title {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
  
  .section-padding {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
  
  .step-indicator {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
  
  .grid.md\\:grid-cols-2 {
    grid-template-columns: 1fr;
  }
  
  .grid.md\\:grid-cols-3 {
    grid-template-columns: 1fr;
  }
}
