/* ===================================================================
 * Gapsnap.AI — Style sheet
 * Brand: warm cream palette, editorial layout, Source Serif 4 headings
 * =================================================================== */

/* ---- CSS Custom Properties (Palette, Typography, Spacing) ---- */
:root {
  --bg:             #fcf8f1;
  --surface:        #ffffff;
  --text-primary:   #2d2a27;
  --text-muted:     #6a655f;
  --primary:        #9a6428;
  --primary-hover:  #7d4e1a;
  --border:         #e3ddd3;
  --accent:         #b53d28;

  --font-display:   'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-body:      'Atkinson Hyperlegible', Arial, Helvetica, sans-serif;
  --font-mono:      'JetBrains Mono', 'Courier New', monospace;

  --radius:         2px;
  --space-unit:     4px;

  --measure:        72ch;
  --line-height-body: 1.6;
  --line-height-heading: 1.2;

  --nav-height:     48px;
  --section-gap:    48px;
}

/* ---- Dark theme ---- */
[data-theme="dark"] {
  --bg:             #1a1814;
  --surface:        #24221e;
  --text-primary:   #e8e4dc;
  --text-muted:     #8f8a83;
  --primary:        #c98a3a;
  --primary-hover:  #dba04e;
  --border:         #3a3732;
  --accent:         #d4583e;
}

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

/* ---- Base ---- */
html {
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line-height-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 200ms ease, color 200ms ease;
}

a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 150ms ease;
}

a:hover {
  color: var(--primary-hover);
}

/* ---- Nav header ---- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background 200ms ease;
}

.nav-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  height: var(--nav-height);
  gap: 24px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
}

.nav-logo:hover {
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 16px;
  list-style: none;
  margin-left: auto;
  align-items: center;
}

.nav-links a {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
}

.nav-links a:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
  line-height: 1;
}

.theme-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
}

/* ---- Container ---- */
.container {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 32px 16px;
  flex: 1;
  width: 100%;
}

/* ---- Eyebrow / Section number ---- */
.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

.section-eyebrow .eyebrow-num {
  color: var(--primary);
  margin-right: 6px;
}

/* ---- Section heading ---- */
.section-heading {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: var(--line-height-heading);
  color: var(--text-primary);
  margin-bottom: 12px;
}

.section-prose {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: var(--line-height-body);
  margin-bottom: 12px;
}

.section-prose:last-child {
  margin-bottom: 0;
}

/* ---- Section divider (1px hairline rule) ---- */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--section-gap) 0 8px 0;
}

/* ---- Full section wrapper ---- */
.content-section {
  margin-top: 16px;
}

/* ===================================================================
 * HERO
 * =================================================================== */
.hero {
  margin-bottom: 32px;
}

.hero-text {
  max-width: var(--measure);
}

.hero-tool {
  margin-top: 24px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

.hero-heading {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: var(--line-height-heading);
  color: var(--text-primary);
  margin-bottom: 12px;
}

.hero-heading .accent-word {
  color: var(--primary);
}

.hero-description {
  font-size: 0.9375rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.hero-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  border-left: 2px solid var(--border);
  padding-left: 12px;
  margin-top: 16px;
}

.hero-tool img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
}

/* ---- Input area ---- */
.input-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.input-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.input-textarea {
  display: block;
  width: 100%;
  min-height: 180px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  transition: border-color 150ms ease;
}

.input-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.input-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.input-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  gap: 8px;
}

/* ---- File upload ---- */
.file-upload-wrapper {
  position: relative;
}

.file-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: 0;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
  user-select: none;
}

.file-label:hover {
  background: var(--primary);
  color: var(--surface);
}

.file-label input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Process button ---- */
.process-btn {
  min-width: 160px;
  padding: 8px 20px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--surface);
  background: var(--primary);
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: background 150ms ease;
}

.process-btn:hover {
  background: var(--primary-hover);
}

.process-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---- Primary CTA (for home page) ---- */
.cta-wrapper {
  margin-top: 20px;
}

.cta-button {
  display: inline-block;
  padding: 10px 28px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--surface);
  background: var(--primary);
  border: none;
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  transition: background 150ms ease;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cta-button:hover {
  background: var(--primary-hover);
  color: var(--surface);
}

.cta-button.secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.cta-button.secondary:hover {
  background: var(--primary);
  color: var(--surface);
}

/* ===================================================================
 * FIGURE / ILLUSTRATION
 * =================================================================== */
.figure-wrapper {
  margin: 20px 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.figure-wrapper svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 400px;
}

.figure-caption {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
  font-style: italic;
}

/* ===================================================================
 * PRICING PAGE
 * =================================================================== */
.limits-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

.limits-list li {
  position: relative;
  padding: 6px 0 6px 24px;
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.limits-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  width: 12px;
  height: 1px;
  background: var(--accent);
}

/* ===================================================================
 * TIMELINE OUTPUT (for app tool page)
 * =================================================================== */
.output-section {
  margin-top: 16px;
}

.timeline-output {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 120px;
}

.timeline-output.has-content {
  animation: fadeIn 300ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .timeline-output.has-content {
    animation: none;
  }
}

.timeline-empty {
  color: var(--text-muted);
  font-size: 0.9375rem;
  text-align: center;
  padding: 48px 16px;
}

.timeline-error {
  color: var(--accent);
  font-size: 0.9375rem;
  padding: 16px;
}

.timeline-notice {
  background: var(--bg);
  border-left: 3px solid var(--primary);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.timeline-notice p {
  margin: 0;
}

.timeline-list {
  list-style: none;
  padding: 0;
  position: relative;
}

.timeline-event {
  position: relative;
}

.timeline-bubble {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 8px 0;
}

.timeline-time {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 10ch;
}

.timeline-text {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.timeline-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 0;
  color: var(--surface);
  background: var(--text-muted);
}

.badge-tried     { background: #8b7355; }
.badge-changed   { background: #5a7d6e; }
.badge-observed  { background: #6a7b8a; }
.badge-investigated { background: #7d6e5a; }
.badge-action    { background: #6e7d5a; }
.badge-resolution { background: #4a7a5a; }

.timeline-connector {
  height: 8px;
  position: relative;
}

.timeline-connector::after {
  content: '';
  display: block;
  height: 1px;
  background: var(--border);
  width: 100%;
}

.timeline-gap {
  list-style: none;
  margin: 12px 0;
  padding: 0;
}

.gap-marker {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.gap-icon {
  font-size: 1rem;
  color: var(--text-muted);
}

.gap-label {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  font-style: italic;
}

.gap-times {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

.timeline-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 0 4px 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.meta-stat {
  white-space: nowrap;
}

.meta-stat.warn {
  color: var(--accent);
}

.timeline-unplaced {
  margin-top: 20px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.timeline-unplaced h3 {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.unplaced-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.5;
}

.timeline-unplaced ul {
  list-style: none;
  padding: 0;
}

.unplaced-line {
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.unplaced-line::before {
  content: '— ';
  color: var(--text-muted);
}

/* ---- Export controls ---- */
.export-controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.export-controls.hidden {
  display: none;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}

.export-btn:hover {
  background: var(--primary);
  color: var(--surface);
}

/* ===================================================================
 * PRICING PAGE
 * =================================================================== */
.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 16px;
}

.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.pricing-card.featured {
  border-color: var(--primary);
}

.pricing-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.pricing-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.pricing-amount {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
  margin-bottom: 4px;
}

.pricing-period {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
  flex: 1;
}

.pricing-features li {
  padding: 6px 0;
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.pricing-features li::before {
  content: '— ';
  color: var(--text-muted);
}

/* Demo checkout form */
.checkout-form {
  margin-top: 24px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.checkout-note {
  background: var(--bg);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.form-input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 150ms ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.submit-btn {
  display: block;
  width: 100%;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--surface);
  background: var(--primary);
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: background 150ms ease;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.submit-btn:hover {
  background: var(--primary-hover);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.submit-btn .loading-text {
  display: none;
}

.submit-btn.loading .normal-text {
  display: none;
}

.submit-btn.loading .loading-text {
  display: inline;
}

/* Success state */
.success-state {
  text-align: center;
  padding: 32px;
}

.success-state .check-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  display: block;
}

.success-state h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.success-state p {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

/* ===================================================================
 * LEGAL PAGES (privacy, terms)
 * =================================================================== */
.legal-note {
  background: var(--bg);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.legal-note p {
  margin: 0;
}

.legal-section {
  margin-top: 20px;
}

.legal-section h2 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.legal-section p {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: var(--line-height-body);
  margin-bottom: 8px;
}

.legal-section ul {
  padding-left: 20px;
  margin-bottom: 8px;
}

.legal-section ul li {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 4px;
}

/* ===================================================================
 * SITE FOOTER
 * =================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer-mark {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--primary);
}

.footer-links {
  display: flex;
  gap: 12px;
  margin-left: auto;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 0.8125rem;
  transition: color 150ms ease;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-constraint {
  font-style: italic;
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===================================================================
 * PAUSE MOTION LINK
 * =================================================================== */
.motion-control {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 1px dotted var(--border);
  cursor: pointer;
  padding: 0;
  margin-left: auto;
}

.motion-control:hover {
  color: var(--primary);
}

/* ===================================================================
 * RESPONSIVE
 * =================================================================== */
@media (max-width: 700px) {
  .container {
    padding: 16px 12px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .hero-heading {
    font-size: 1.5rem;
  }

  .input-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .file-label {
    justify-content: center;
  }

  .process-btn {
    width: 100%;
    text-align: center;
  }

  .timeline-metadata {
    flex-direction: column;
    gap: 4px;
  }

  .export-controls {
    flex-direction: column;
  }

  .export-btn {
    justify-content: center;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .nav-inner {
    gap: 12px;
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px;
  }

  .nav-links {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
    gap: 12px;
  }

  .section-heading {
    font-size: 1.25rem;
  }

  .section-divider {
    margin: 32px 0 8px 0;
  }

  .content-section {
    margin-top: 12px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 4px;
  }

  .footer-links {
    margin-left: 0;
  }
}

/* ---- Print ---- */
@media print {
  .site-header { display: none; }
  .theme-toggle { display: none; }
  .export-controls { display: none; }
}