/* Cultural Artifact Memory Preserver - Styles */

:root {
  --ink: #2c2416;
  --paper: #fdfaf3;
  --warm-cream: #f5e6d3;
  --earth: #8b5e3c;
  --earth-light: #c49a6c;
  --earth-dark: #5c3a1e;
  --sage: #7a8b6e;
  --sage-light: #e8efe2;
  --rust: #a65d3c;
  --border: #d4c5b2;
  --shadow: rgba(44, 36, 22, 0.08);
  --radius: 6px;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

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

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

/* Header */
.site-header {
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px var(--shadow);
}

.header-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
}

.logo-text {
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--warm-cream);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.site-nav a:hover {
  color: #fff;
  text-decoration: underline;
}

/* Main Layout */
.main-layout {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  flex: 1;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 1px 4px var(--shadow);
}

.sidebar-section h2 {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--earth-dark);
  margin-bottom: 0.5rem;
  border-bottom: 2px solid var(--warm-cream);
  padding-bottom: 0.4rem;
}

.sidebar-section ul {
  list-style: none;
  padding: 0;
}

.sidebar-section li {
  font-size: 0.85rem;
  padding: 0.3rem 0;
  border-bottom: 1px dotted var(--border);
  color: var(--ink);
}

.sidebar-section li:last-child {
  border-bottom: none;
}

.saved-list {
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.82rem;
}

.saved-list .saved-item {
  padding: 0.4rem 0;
  border-bottom: 1px dotted var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.saved-list .saved-item:hover {
  background: var(--sage-light);
}

.empty-state {
  color: #999;
  font-style: italic;
  font-size: 0.82rem;
}

/* Worksheet Area */
.worksheet-area {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.intro-section h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--earth-dark);
  margin-bottom: 0.5rem;
}

.lead {
  font-size: 1.05rem;
  color: #5c4a3a;
  max-width: 650px;
}

/* Tabs */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 2px solid var(--earth);
  margin-bottom: 1.25rem;
}

.tab {
  padding: 0.6rem 1.2rem;
  border: none;
  background: var(--warm-cream);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: background 0.2s, color 0.2s;
}

.tab:hover {
  background: var(--earth-light);
  color: #fff;
}

.tab.active {
  background: var(--earth);
  color: #fff;
  font-weight: 600;
}

/* Worksheet Body */
.worksheet-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.form-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 2px 8px var(--shadow);
}

.field-group {
  margin-bottom: 1rem;
  position: relative;
}

.field-group label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
  color: var(--earth-dark);
}

.required {
  color: var(--rust);
}

.field-group input,
.field-group textarea,
.field-group select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  background: var(--paper);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  outline: none;
  border-color: var(--earth);
  box-shadow: 0 0 0 3px rgba(139, 94, 60, 0.15);
}

.example-btn {
  font-size: 0.75rem;
  background: none;
  border: none;
  color: var(--sage);
  cursor: pointer;
  padding: 0.15rem 0;
  text-decoration: underline;
  margin-top: 0.15rem;
}

.example-btn:hover {
  color: var(--earth);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* Buttons */
.btn {
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--earth);
  color: #fff;
}

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

.btn-secondary {
  background: var(--sage);
  color: #fff;
}

.btn-secondary:hover {
  background: #5c6e52;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
}

.btn-outline:hover {
  background: var(--warm-cream);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
}

/* Preview Panel */
.preview-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 2px 8px var(--shadow);
  position: sticky;
  top: 80px;
  align-self: start;
}

.preview-panel h3 {
  font-family: var(--font-serif);
  color: var(--earth-dark);
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.preview-box {
  background: var(--paper);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  min-height: 200px;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.preview-placeholder {
  color: #aaa;
  font-style: italic;
}

/* Supporting Content */
.supporting-content {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 2px 8px var(--shadow);
}

.supporting-content h2 {
  font-family: var(--font-serif);
  color: var(--earth-dark);
  font-size: 1.3rem;
  margin: 1.5rem 0 0.6rem;
}

.supporting-content h2:first-child {
  margin-top: 0;
}

.supporting-content p {
  margin-bottom: 0.8rem;
  max-width: 680px;
}

.mistakes-list {
  list-style: none;
  padding: 0;
  margin-bottom: 1.2rem;
}

.mistakes-list li {
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--border);
  font-size: 0.9rem;
}

.faq-list dt {
  font-weight: 700;
  margin-top: 0.8rem;
  color: var(--earth-dark);
}

.faq-list dd {
  margin-left: 0;
  margin-bottom: 0.6rem;
  font-size: 0.9rem;
  color: #4a3f33;
}

.version-note {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: #888;
}

/* Footer */
.site-footer {
  background: var(--ink);
  color: var(--warm-cream);
  text-align: center;
  padding: 1.25rem 1.5rem;
  font-size: 0.82rem;
  margin-top: auto;
}

.site-footer a {
  color: var(--earth-light);
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }

  .worksheet-body {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }

  .tab {
    font-size: 0.8rem;
    padding: 0.5rem 0.8rem;
  }

  .intro-section h1 {
    font-size: 1.5rem;
  }
}

@media (max-width: 500px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav {
    gap: 0.75rem;
  }

  .form-actions {
    flex-direction: column;
  }

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

  .supporting-content {
    padding: 1rem;
  }
}

/* Print styles */
@media print {
  .site-header,
  .site-footer,
  .sidebar,
  .form-panel,
  .tab-bar,
  .form-actions,
  .example-btn,
  .intro-section,
  .supporting-content {
    display: none !important;
  }

  .main-layout {
    display: block;
    max-width: 100%;
    padding: 0;
  }

  .worksheet-body {
    display: block;
  }

  .preview-panel {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0;
  }

  .preview-box {
    border: none;
    font-size: 12pt;
    line-height: 1.5;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }
}



/* 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;
}
