/* YarnBomb Map - Neighborhood Fiber Art Registry */
:root {
  --c-primary: #E85D4A;
  --c-primary-dark: #C44536;
  --c-primary-light: #FFF0ED;
  --c-accent: #D4A574;
  --c-accent-dark: #B8894E;
  --c-bg: #FFFDF9;
  --c-surface: #FFFFFF;
  --c-surface-alt: #F5E6D3;
  --c-text: #2D2A26;
  --c-text-light: #6B6560;
  --c-text-muted: #9E9891;
  --c-border: #E8E0D8;
  --c-success: #2D8A4E;
  --c-success-bg: #E8F5ED;
  --c-shadow: 0 2px 8px rgba(45, 42, 38, 0.08);
  --c-shadow-lg: 0 8px 32px rgba(45, 42, 38, 0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  --max-width: 1100px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 70px; }

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

a { color: var(--c-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(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--c-text);
  flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo-text { font-weight: 700; font-size: 1.1rem; }
.logo-text em { font-style: normal; color: var(--c-primary); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius);
  color: var(--c-text-light);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover, .nav-link.active {
  background: var(--c-primary-light);
  color: var(--c-primary);
  text-decoration: none;
}
.nav-cta {
  background: var(--c-primary);
  color: #fff;
}
.nav-cta:hover {
  background: var(--c-primary-dark);
  color: #fff;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--c-text);
  border-radius: 1px;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--c-primary-light) 0%, var(--c-surface-alt) 100%);
  padding: 60px 0 48px;
  text-align: center;
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  color: var(--c-text);
}

.hero-sub {
  font-size: 1.1rem;
  color: var(--c-text-light);
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 32px;
}

.stat { text-align: center; }
.stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--c-primary);
  line-height: 1;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.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);
}
.btn-secondary {
  background: var(--c-surface);
  color: var(--c-text);
  border-color: var(--c-border);
}
.btn-secondary:hover {
  background: var(--c-surface-alt);
}
.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}
.btn-danger {
  background: #fff;
  color: #c0392b;
  border-color: #f5c6cb;
}
.btn-danger:hover { background: #fff5f5; }

/* Sections */
.section {
  padding: 56px 0;
}
.section:nth-child(even) {
  background: var(--c-surface);
}

.section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-desc {
  color: var(--c-text-light);
  margin-bottom: 24px;
}

/* Map */
.map-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.map-controls label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--c-text-light);
}
.map-controls select {
  padding: 6px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--c-surface);
  color: var(--c-text);
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
  padding: 12px;
  background: var(--c-surface-alt);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
}

.map-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  padding: 4px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  border: 2px solid transparent;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  line-height: 1.2;
  overflow: hidden;
}
.map-cell:hover {
  transform: scale(1.05);
  box-shadow: var(--c-shadow);
  z-index: 1;
}
.map-cell:focus {
  outline: 3px solid var(--c-primary);
  outline-offset: 2px;
}
.map-cell-empty {
  background: #E8E0D8;
  color: var(--c-text-muted);
  text-shadow: none;
  cursor: default;
}
.map-cell-empty:hover { transform: none; box-shadow: none; }

.map-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--c-text-light);
}
.map-empty svg { margin-bottom: 16px; }
.map-empty h3 { margin-bottom: 8px; }

.map-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--c-shadow-lg);
  padding: 24px;
  max-width: 420px;
  width: 90vw;
  z-index: 200;
  max-height: 80vh;
  overflow-y: auto;
}
.map-popup[hidden] { display: none; }
.popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--c-text-muted);
  line-height: 1;
}
.popup-close:hover { color: var(--c-text); }

.popup-entry {
  padding: 12px 0;
  border-bottom: 1px solid var(--c-border);
}
.popup-entry:last-child { border-bottom: none; }
.popup-entry h4 { font-size: 0.95rem; margin-bottom: 4px; }
.popup-entry p { font-size: 0.85rem; color: var(--c-text-light); }
.popup-entry .popup-date { font-size: 0.8rem; color: var(--c-text-muted); }

.map-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 199;
}
.map-overlay[hidden] { display: none; }

/* Timeline */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-entry {
  display: flex;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--c-border);
  position: relative;
}
.timeline-entry:last-child { border-bottom: none; }

.timeline-marker {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-top: 2px;
}

.timeline-content { flex: 1; }
.timeline-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}
.timeline-meta {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  margin-bottom: 6px;
}
.timeline-content p {
  font-size: 0.9rem;
  color: var(--c-text-light);
}

.timeline-empty {
  text-align: center;
  padding: 40px;
  color: var(--c-text-muted);
}

/* Registry */
.registry-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.registry-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.registry-actions input[type="search"] {
  padding: 8px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  min-width: 200px;
  background: var(--c-surface);
}

.registry-actions select {
  padding: 8px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--c-surface);
}

.registry-table-wrap {
  overflow-x: auto;
}

.registry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.registry-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--c-surface-alt);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--c-text-light);
  border-bottom: 2px solid var(--c-border);
}

.registry-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}

.registry-table tr:hover td {
  background: var(--c-primary-light);
}

.registry-table .actions-cell {
  white-space: nowrap;
}
.registry-table .actions-cell button {
  margin-right: 4px;
  padding: 4px 10px;
  font-size: 0.8rem;
}

.registry-empty {
  text-align: center;
  padding: 40px;
  color: var(--c-text-muted);
}

.yarn-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.yarn-acrylic { background: #FFE0D6; color: #B8452A; }
.yarn-wool { background: #E8D5C4; color: #8B6914; }
.yarn-cotton { background: #D6E8F5; color: #2A5A8B; }
.yarn-blend { background: #D6F5E0; color: #2A8B5A; }
.yarn-other { background: #E8E0F5; color: #5A2A8B; }

/* Form */
.form-section {
  background: var(--c-surface-alt) !important;
}

.entry-form {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--c-shadow);
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group-wide {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--c-text);
}

.required { color: var(--c-primary); }

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(232, 93, 74, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--c-text-muted);
}

.field-hint {
  font-size: 0.78rem;
  color: var(--c-text-muted);
}

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

.form-success {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--c-success-bg);
  border-radius: var(--radius);
  color: var(--c-success);
  font-weight: 600;
}
.form-success[hidden] { display: none; }

/* Guide */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.guide-card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--c-shadow);
  border: 1px solid var(--c-border);
}

.guide-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.guide-card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.guide-card p {
  font-size: 0.9rem;
  color: var(--c-text-light);
}

.guide-notes {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--c-shadow);
  border: 1px solid var(--c-border);
}

.guide-notes h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  margin-top: 24px;
}
.guide-notes h3:first-child { margin-top: 0; }

.guide-notes ul {
  padding-left: 20px;
  margin-bottom: 8px;
}

.guide-notes li {
  font-size: 0.9rem;
  color: var(--c-text-light);
  margin-bottom: 6px;
}

.guide-notes p {
  font-size: 0.9rem;
  color: var(--c-text-light);
  line-height: 1.7;
}

/* Footer */
.site-footer {
  background: var(--c-text);
  color: rgba(255,255,255,0.7);
  padding: 40px 0 20px;
  font-size: 0.85rem;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 24px;
}

.footer-brand .logo-text {
  color: #fff;
  font-size: 1rem;
}
.footer-brand p {
  margin-top: 4px;
  font-size: 0.8rem;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
}
.footer-links a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 16px;
  text-align: center;
}

.footer-bottom a {
  color: rgba(255,255,255,0.9);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--c-text);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  z-index: 300;
  box-shadow: var(--c-shadow-lg);
  animation: toastIn 0.3s ease;
}
.toast[hidden] { display: none; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
  .main-nav { display: none; }
  .main-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    padding: 12px 20px;
    box-shadow: var(--c-shadow);
  }
  .menu-toggle { display: flex; }
  .hero h1 { font-size: 1.8rem; }
  .hero-stats { gap: 24px; }
  .stat-num { font-size: 1.5rem; }
  .form-grid { grid-template-columns: 1fr; }
  .registry-header { flex-direction: column; align-items: flex-start; }
  .registry-actions { width: 100%; }
  .registry-actions input[type="search"] { flex: 1; min-width: 0; }
  .map-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
}

@media (max-width: 480px) {
  .hero { padding: 40px 0 32px; }
  .hero h1 { font-size: 1.5rem; }
  .hero-actions { flex-direction: column; align-items: center; }
  .section { padding: 40px 0; }
  .guide-grid { grid-template-columns: 1fr; }
}

/* Print */
@media print {
  .site-header, .site-footer, .hero-actions, .map-controls, .registry-actions, .form-section, .guide-section { display: none; }
  .section { padding: 16px 0; }
  body { background: #fff; }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; }
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}



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