/* Letter of Explanation Builder — styles.css */
:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #dbeafe;
  --color-success: #16a34a;
  --color-success-light: #dcfce7;
  --color-warn: #d97706;
  --color-warn-light: #fef3c7;
  --color-danger: #dc2626;
  --color-danger-light: #fee2e2;
  --color-text: #1e293b;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-border-focus: #93c5fd;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
  --max-width: 1200px;
  --transition: .2s ease;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.1rem;
}
.logo:hover { text-decoration: none; }
.logo-text { letter-spacing: -.01em; }
.site-nav {
  display: flex;
  gap: 24px;
}
.site-nav a {
  color: var(--color-text-secondary);
  font-size: .9rem;
  font-weight: 500;
  padding: 4px 0;
}
.site-nav a:hover { color: var(--color-primary); text-decoration: none; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, #7c3aed 100%);
  color: #fff;
  padding: 80px 0 72px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.2;
  max-width: 640px;
  margin: 0 auto 16px;
}
.hero-sub {
  font-size: 1.1rem;
  opacity: .9;
  max-width: 520px;
  margin: 0 auto 32px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
  line-height: 1.4;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); text-decoration: none; color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}
.btn-ghost:hover { background: var(--color-bg); color: var(--color-text); text-decoration: none; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Builder section */
.builder-section {
  padding: 48px 0 64px;
}
.builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}
.panel-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
}

/* Form */
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 4px;
  color: var(--color-text);
}
.optional {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: .85rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-border-focus);
}
.form-group textarea { resize: vertical; }
.field-hint {
  display: block;
  font-size: .8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* Preview panel */
.builder-preview-panel {
  position: sticky;
  top: 72px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}
.preview-header h3 { font-size: 1rem; font-weight: 700; }
.preview-actions { display: flex; gap: 6px; }

.tone-tip {
  padding: 10px 18px;
  font-size: .85rem;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border-bottom: 1px solid var(--color-border);
  display: none;
}
.tone-tip.visible { display: block; }

.letter-preview {
  padding: 24px;
  min-height: 400px;
  font-size: .95rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text);
}
.letter-preview .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 350px;
  color: var(--color-text-muted);
  text-align: center;
  gap: 12px;
}
.letter-preview .empty-state p { max-width: 280px; font-size: .9rem; }

.warning-box {
  padding: 10px 18px;
  font-size: .85rem;
  background: var(--color-warn-light);
  color: #92400e;
  border-top: 1px solid #fde68a;
  display: none;
}
.warning-box.visible { display: block; }

/* Scenarios */
.scenarios-section {
  padding: 64px 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}
.scenarios-section h2,
.tips-section h2,
.faq-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.section-sub {
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  max-width: 600px;
}
.scenario-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.scenario-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: box-shadow var(--transition);
}
.scenario-card:hover { box-shadow: var(--shadow-md); }
.scenario-icon { margin-bottom: 12px; }
.scenario-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.scenario-card p { font-size: .9rem; color: var(--color-text-secondary); line-height: 1.55; }

/* Tips */
.tips-section {
  padding: 64px 0;
  border-top: 1px solid var(--color-border);
}
.tips-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}
.tip-block {
  background: var(--color-success-light);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 24px;
}
.tip-block-warn {
  background: var(--color-danger-light);
  border-color: #fecaca;
}
.tip-block h3 { font-size: 1rem; font-weight: 700; margin-bottom: 12px; }
.tip-block ul { padding-left: 20px; }
.tip-block li { font-size: .9rem; margin-bottom: 6px; color: var(--color-text-secondary); }

.assumptions-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
}
.assumptions-box h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.assumptions-box p { font-size: .9rem; color: var(--color-text-secondary); line-height: 1.6; }

/* FAQ */
.faq-section {
  padding: 64px 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}
.faq-list { max-width: 760px; }
.faq-item { margin-bottom: 24px; }
.faq-item dt {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--color-text);
}
.faq-item dd {
  font-size: .9rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* Footer */
.site-footer {
  background: var(--color-text);
  color: #cbd5e1;
  padding: 48px 0 24px;
}
.footer-top {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 32px;
  margin-bottom: 32px;
}
.footer-brand { max-width: 320px; }
.logo-text-sm { font-weight: 700; font-size: 1rem; color: #fff; }
.footer-desc { font-size: .85rem; margin-top: 8px; line-height: 1.5; }
.footer-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-nav a { color: #94a3b8; font-size: .85rem; }
.footer-nav a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid #334155;
  padding-top: 20px;
  font-size: .8rem;
  color: #64748b;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.footer-bottom a { color: #94a3b8; }
.footer-bottom a:hover { color: #fff; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-text);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  opacity: 0;
  transform: translateY(8px);
  transition: all .3s ease;
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: translateY(0); }

/* Responsive */
@media (max-width: 900px) {
  .builder-grid { grid-template-columns: 1fr; }
  .builder-preview-panel { position: static; }
  .tips-grid { grid-template-columns: 1fr; }
  .hero { padding: 56px 0 48px; }
}
@media (max-width: 600px) {
  .site-header .container { height: 52px; }
  .site-nav { gap: 14px; }
  .site-nav a { font-size: .82rem; }
  .hero h1 { font-size: 1.5rem; }
  .hero-sub { font-size: .95rem; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
  .preview-actions { flex-wrap: wrap; }
  .scenario-cards { grid-template-columns: 1fr; }
  .footer-top { flex-direction: column; }
}

/* Print */
@media print {
  .site-header, .site-footer, .hero, .builder-form-panel, .preview-actions, .tone-tip, .warning-box, .scenarios-section, .tips-section, .faq-section, .form-actions { display: none !important; }
  .builder-preview-panel { border: none; box-shadow: none; position: static; }
  .letter-preview { padding: 0; font-size: 12pt; line-height: 1.5; }
  body { background: #fff; }
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
