/* Survivor Memory Scanner – Grounded, warm, accessible */
:root {
  --color-bg: #faf7f2;
  --color-surface: #ffffff;
  --color-text: #2c2b28;
  --color-text-soft: #5e5b54;
  --color-accent: #7a5c3a;
  --color-accent-soft: #c4a87c;
  --color-border: #e0d9cc;
  --color-danger: #b53b3b;
  --color-focus: #4a6fa5;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --max-width: 1200px;
}

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

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

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

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

/* Header */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.1rem;
}
.logo svg {
  color: var(--color-accent);
}
.nav-list {
  list-style: none;
  display: flex;
  gap: 20px;
}
.nav-list a {
  text-decoration: none;
  color: var(--color-text-soft);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}
.nav-list a:hover,
.nav-list a:focus-visible {
  border-bottom-color: var(--color-accent);
  color: var(--color-text);
}

/* Main scanner layout */
.scanner-layout {
  max-width: var(--max-width);
  margin: 24px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  flex: 1;
}

@media (max-width: 800px) {
  .scanner-layout {
    grid-template-columns: 1fr;
  }
}

.input-panel,
.output-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.panel-header {
  margin-bottom: 16px;
}
.panel-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
}
.panel-subtitle {
  font-size: 0.9rem;
  color: var(--color-text-soft);
  margin-top: 4px;
}

/* Entries */
.entries-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  overflow-y: auto;
  max-height: 60vh;
  padding-right: 4px;
}

.entry-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--color-bg);
  position: relative;
}
.entry-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.entry-card .entry-number {
  color: var(--color-accent);
  font-weight: 700;
}
.entry-card label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-soft);
  margin-top: 8px;
  margin-bottom: 2px;
}
.entry-card input,
.entry-card textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
  resize: vertical;
}
.entry-card textarea {
  min-height: 60px;
}
.entry-card input:focus,
.entry-card textarea:focus {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
  border-color: var(--color-focus);
}
.entry-card .delete-entry-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: 1px solid transparent;
  color: var(--color-text-soft);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.entry-card .delete-entry-btn:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--color-accent);
  color: #fff;
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background: #684c2e;
}
.btn-secondary {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: var(--color-bg);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-soft);
  font-weight: 500;
  padding: 6px 12px;
  font-size: 0.85rem;
}
.btn-ghost:hover {
  color: var(--color-text);
  text-decoration: underline;
}
.btn-danger:hover {
  color: var(--color-danger);
}

.input-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.entry-controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.storage-note {
  font-size: 0.75rem;
  color: var(--color-text-soft);
  margin-top: 10px;
}

/* Output */
.output-content {
  flex: 1;
  min-height: 200px;
  padding: 12px;
  background: var(--color-bg);
  border-radius: var(--radius);
  font-size: 0.95rem;
  line-height: 1.7;
  overflow-y: auto;
  max-height: 60vh;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-text-soft);
  height: 100%;
  gap: 12px;
  padding: 20px;
}
.empty-state svg {
  opacity: 0.5;
}
.narrative-block h3 {
  font-size: 1.1rem;
  margin: 16px 0 6px;
  color: var(--color-accent);
}
.narrative-block p {
  margin-bottom: 12px;
}
.pattern-badge {
  display: inline-block;
  background: var(--color-accent-soft);
  color: #3b2e1e;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 4px;
}
.output-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* Supporting content */
.supporting-content {
  max-width: var(--max-width);
  margin: 40px auto;
  padding: 0 20px 40px;
}
.support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.support-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.support-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--color-accent);
}
.support-card p,
.support-card li {
  font-size: 0.9rem;
  color: var(--color-text-soft);
  margin-bottom: 8px;
}
.support-card ul,
.support-card ol {
  padding-left: 20px;
  margin-bottom: 8px;
}

/* Footer */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 20px;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--color-text-soft);
}
.footer-inner nav a {
  margin-left: 16px;
  color: var(--color-text-soft);
  text-decoration: none;
}
.footer-inner nav a:hover {
  text-decoration: underline;
}
.footer-note {
  width: 100%;
  text-align: center;
  margin-top: 8px;
  font-size: 0.75rem;
}

/* Print styles */
@media print {
  .site-header,
  .input-panel,
  .output-actions,
  .supporting-content,
  .site-footer,
  .skip-link {
    display: none !important;
  }
  .scanner-layout {
    display: block;
  }
  .output-panel {
    box-shadow: none;
    border: none;
  }
  .output-content {
    max-height: none;
  }
}

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

/* Utility */
[hidden] {
  display: none !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;
}
