/* CivicVoice: Public Comment Drafter */
:root {
  --c-primary: #1a5276;
  --c-primary-light: #2980b9;
  --c-primary-dark: #0e3a54;
  --c-accent: #e67e22;
  --c-accent-hover: #d35400;
  --c-bg: #f7f9fb;
  --c-surface: #ffffff;
  --c-surface-alt: #eef3f7;
  --c-text: #1c2833;
  --c-text-secondary: #566573;
  --c-text-muted: #85929e;
  --c-border: #d5dce3;
  --c-border-light: #e8edf2;
  --c-success: #27ae60;
  --c-focus: rgba(41, 128, 185, 0.4);
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
  --max-width: 1200px;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--c-primary-light);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover, a:focus {
  color: var(--c-primary);
  text-decoration: underline;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--c-primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 1000;
  font-weight: 600;
}
.skip-link:focus {
  top: 0;
}

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

/* Header */
.site-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--c-primary);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
}
.logo:hover, .logo:focus {
  color: var(--c-primary-dark);
  text-decoration: none;
}
.logo-icon {
  flex-shrink: 0;
}
.main-nav ul {
  display: flex;
  list-style: none;
  gap: 24px;
}
.main-nav a {
  color: var(--c-text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.main-nav a:hover,
.main-nav a:focus,
.main-nav a[aria-current="page"] {
  color: var(--c-primary);
  border-bottom-color: var(--c-primary);
  text-decoration: none;
}

/* Hero */
.hero-section {
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
  color: #fff;
  padding: 48px 0 44px;
}
.hero-section h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
}
.hero-sub {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 600px;
}

/* Workspace */
.workspace-section {
  padding: 32px 0;
}
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.draft-panel,
.preview-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.panel-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--c-primary-dark);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--c-border-light);
}

/* Form */
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--c-text);
}
.form-group .hint {
  font-weight: 400;
  color: var(--c-text-muted);
  font-size: 0.82rem;
}
input[type="text"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--c-text);
  background: var(--c-surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}
input[type="text"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--c-primary-light);
  box-shadow: 0 0 0 3px var(--c-focus);
}
textarea {
  resize: vertical;
  min-height: 100px;
}

.range-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
input[type="range"] {
  flex: 1;
  accent-color: var(--c-primary);
}
.range-group output {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--c-primary);
  min-width: 48px;
  text-align: right;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--c-border-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
}
.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--c-focus);
}
.btn-primary {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}
.btn-primary:hover {
  background: var(--c-primary-dark);
  border-color: var(--c-primary-dark);
  color: #fff;
  text-decoration: none;
}
.btn-secondary {
  background: var(--c-surface);
  color: var(--c-primary);
  border-color: var(--c-primary);
}
.btn-secondary:hover {
  background: var(--c-surface-alt);
  text-decoration: none;
}
.btn-ghost {
  background: transparent;
  color: var(--c-text-secondary);
  border-color: var(--c-border);
}
.btn-ghost:hover {
  background: var(--c-surface-alt);
  color: var(--c-text);
  text-decoration: none;
}

/* Preview */
.preview-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--c-text-muted);
}
.preview-empty svg {
  margin-bottom: 12px;
}
.preview-empty p {
  font-size: 0.95rem;
  max-width: 280px;
  margin: 0 auto;
}
.preview-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.preview-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.meta-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--c-surface-alt);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-primary);
}
.preview-text {
  background: var(--c-surface-alt);
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
  font-family: var(--font-sans);
}
.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.copy-confirm {
  color: var(--c-success);
  font-weight: 600;
  font-size: 0.88rem;
}

/* History */
.history-section {
  padding: 32px 0;
}
.history-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--c-primary-dark);
  margin-bottom: 4px;
}
.section-note {
  color: var(--c-text-muted);
  font-size: 0.88rem;
  margin-bottom: 16px;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-item {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.history-item-info {
  flex: 1;
  min-width: 0;
}
.history-item-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-meta {
  font-size: 0.82rem;
  color: var(--c-text-muted);
  margin-top: 2px;
}
.history-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.history-item-actions .btn {
  padding: 6px 14px;
  font-size: 0.82rem;
}
.empty-state {
  color: var(--c-text-muted);
  font-size: 0.92rem;
  text-align: center;
  padding: 24px;
}

/* Guide */
.guide-section {
  padding: 32px 0 48px;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}
.guide-block {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.guide-block h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--c-primary-dark);
  margin-bottom: 12px;
}
.guide-block p,
.guide-block li {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--c-text-secondary);
}
.guide-block ul,
.guide-block ol {
  padding-left: 20px;
  margin-bottom: 12px;
}
.guide-block li {
  margin-bottom: 6px;
}
.guide-block dl {
  margin-bottom: 0;
}
.guide-block dt {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--c-text);
  margin-top: 12px;
}
.guide-block dt:first-child {
  margin-top: 0;
}
.guide-block dd {
  font-size: 0.88rem;
  color: var(--c-text-secondary);
  margin-left: 0;
  margin-top: 2px;
}
.guide-block strong {
  color: var(--c-text);
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--c-primary-dark);
  color: rgba(255,255,255,0.8);
  padding: 32px 0;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}
.footer-brand {
  font-weight: 600;
  font-size: 0.95rem;
}
.footer-nav ul {
  display: flex;
  list-style: none;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-nav a {
  color: rgba(255,255,255,0.75);
  font-size: 0.88rem;
  font-weight: 500;
}
.footer-nav a:hover,
.footer-nav a:focus {
  color: #fff;
}
.footer-meta {
  font-size: 0.8rem;
  opacity: 0.6;
}

/* Responsive */
@media (max-width: 900px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .preview-panel {
    order: -1;
  }
}

@media (max-width: 600px) {
  .header-inner {
    flex-direction: column;
    height: auto;
    padding: 12px 0;
    gap: 8px;
  }
  .hero-section {
    padding: 32px 0 28px;
  }
  .hero-section h1 {
    font-size: 1.4rem;
  }
  .hero-sub {
    font-size: 0.95rem;
  }
  .draft-panel,
  .preview-panel {
    padding: 20px;
  }
  .form-actions {
    flex-direction: column;
  }
  .form-actions .btn {
    width: 100%;
  }
  .preview-actions {
    flex-direction: column;
  }
  .preview-actions .btn {
    width: 100%;
  }
  .history-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .history-item-actions {
    width: 100%;
  }
  .history-item-actions .btn {
    flex: 1;
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
}

/* Print */
@media print {
  .site-header,
  .site-footer,
  .workspace-section,
  .history-section,
  .guide-section,
  .hero-section {
    display: none;
  }
  .preview-panel {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .preview-actions,
  .preview-meta {
    display: none;
  }
  .preview-text {
    border: none;
    padding: 0;
    max-height: none;
    overflow: visible;
    font-size: 12pt;
    line-height: 1.5;
  }
}

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

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !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;
}
