/* ScrapSaver - Fabric Scrap Calculator Styles */
:root {
  --color-warm: #c47a4a;
  --color-cool: #6b8e6b;
  --color-purple: #8b5e8b;
  --color-gold: #c4a74a;
  --color-cream: #fdf6ee;
  --color-linen: #f5e6d3;
  --color-charcoal: #2d2d2d;
  --color-mid: #5a5a5a;
  --color-light: #e8e0d8;
  --color-white: #ffffff;
  --color-danger: #b94a4a;
  --color-success: #4a7a4a;
  --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-heading: Georgia, 'Times New Roman', serif;
  --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);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --max-width: 1200px;
  --header-height: 64px;
}

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

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

body {
  font-family: var(--font-body);
  color: var(--color-charcoal);
  background-color: var(--color-cream);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* Header */
.site-header {
  background: var(--color-white);
  border-bottom: 2px solid var(--color-linen);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-charcoal);
  text-decoration: none;
}

.logo:hover {
  opacity: 0.8;
}

.main-nav {
  display: flex;
  gap: 24px;
}

.main-nav a {
  color: var(--color-mid);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
}

.main-nav a:hover {
  color: var(--color-warm);
}

/* Hero Section */
.hero-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 60px 0;
}

.hero-text h1 {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  line-height: 1.2;
  color: var(--color-charcoal);
  margin-bottom: 16px;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--color-mid);
  margin-bottom: 24px;
  max-width: 480px;
}

.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.scrap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 240px;
  height: 240px;
}

.scrap {
  border-radius: var(--radius);
  transition: transform 0.3s;
}

.scrap:hover {
  transform: scale(1.05);
}

.s1 { background: var(--color-warm); }
.s2 { background: var(--color-cool); }
.s3 { background: var(--color-purple); }
.s4 { background: var(--color-gold); }
.s5 { background: var(--color-linen); border: 2px dashed var(--color-mid); }
.s6 { background: linear-gradient(135deg, var(--color-warm), var(--color-gold)); }

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  font-family: var(--font-body);
}

.btn-primary {
  background: var(--color-warm);
  color: var(--color-white);
  border-color: var(--color-warm);
}

.btn-primary:hover {
  background: #a86535;
  border-color: #a86535;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
  background: var(--color-light);
  color: var(--color-charcoal);
  border-color: var(--color-light);
}

.btn-sm:hover {
  background: #d4ccc2;
}

.btn-danger {
  background: transparent;
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background: var(--color-danger);
  color: var(--color-white);
}

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

/* Calculator Section */
.calculator-section {
  padding: 40px 0 60px;
}

.calculator-section h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin-bottom: 24px;
}

.calc-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

.panel-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.panel-card h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  margin-bottom: 16px;
  color: var(--color-charcoal);
}

.hint {
  font-size: 0.85rem;
  color: var(--color-mid);
  margin-bottom: 12px;
}

/* Form Styles */
.scrap-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.form-row label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-mid);
}

.form-row input,
.form-row select {
  padding: 10px 12px;
  border: 2px solid var(--color-light);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--color-white);
  transition: border-color 0.2s;
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--color-warm);
}

.form-row input::placeholder {
  color: #bbb;
}

/* Presets */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-btn {
  padding: 10px 12px;
  border: 2px solid var(--color-light);
  border-radius: var(--radius);
  background: var(--color-cream);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
  text-align: center;
}

.preset-btn:hover {
  border-color: var(--color-warm);
  background: var(--color-linen);
}

/* Summary Stats */
.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  text-align: center;
  padding: 12px 8px;
  background: var(--color-cream);
  border-radius: var(--radius);
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-warm);
  font-family: var(--font-heading);
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--color-mid);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Color Breakdown */
.color-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.color-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Project Suggestions */
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.result-actions {
  display: flex;
  gap: 6px;
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card {
  padding: 16px;
  border: 2px solid var(--color-light);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.project-card:hover {
  border-color: var(--color-warm);
}

.project-card h4 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.project-card .project-desc {
  font-size: 0.9rem;
  color: var(--color-mid);
  margin-bottom: 8px;
}

.project-card .project-meta {
  font-size: 0.8rem;
  color: var(--color-warm);
  font-weight: 600;
}

.project-card .project-blocks {
  margin-top: 8px;
  font-size: 0.85rem;
}

/* Scrap List */
.scrap-list-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.scrap-list {
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
}

.scrap-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-light);
  font-size: 0.9rem;
}

.scrap-list li:last-child {
  border-bottom: none;
}

.scrap-list .scrap-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scrap-list .scrap-swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.1);
}

.scrap-list .scrap-details {
  font-size: 0.8rem;
  color: var(--color-mid);
}

.scrap-list .remove-btn {
  background: none;
  border: none;
  color: var(--color-danger);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.scrap-list .remove-btn:hover {
  background: #fde8e8;
}

/* Empty States */
.empty-state {
  color: var(--color-mid);
  font-size: 0.9rem;
  font-style: italic;
  text-align: center;
  padding: 16px;
}

.empty-state-large {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-mid);
}

.empty-state-large svg {
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Patterns Section */
.patterns-section {
  padding: 60px 0;
  background: var(--color-white);
}

.patterns-section h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin-bottom: 8px;
}

.section-intro {
  color: var(--color-mid);
  margin-bottom: 32px;
  max-width: 600px;
}

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.pattern-card {
  background: var(--color-cream);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 2px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pattern-card:hover {
  border-color: var(--color-warm);
  box-shadow: var(--shadow-md);
}

.pattern-icon {
  margin-bottom: 12px;
}

.pattern-card h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.pattern-meta {
  font-size: 0.8rem;
  color: var(--color-warm);
  font-weight: 600;
  margin-bottom: 8px;
}

.pattern-card p:last-child {
  font-size: 0.9rem;
  color: var(--color-mid);
}

/* Stash Section */
.stash-section {
  padding: 60px 0;
}

.stash-section h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin-bottom: 24px;
}

.stash-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.stash-tips h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin: 20px 0 8px;
  color: var(--color-charcoal);
}

.stash-tips h3:first-child {
  margin-top: 0;
}

.stash-tips p {
  font-size: 0.95rem;
  color: var(--color-mid);
  margin-bottom: 12px;
}

.stash-reference h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin: 20px 0 12px;
  color: var(--color-charcoal);
}

.stash-reference h3:first-child {
  margin-top: 0;
}

.reference-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.reference-table th,
.reference-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-light);
}

.reference-table th {
  background: var(--color-cream);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-mid);
}

.reference-table td {
  color: var(--color-charcoal);
}

.mistake-list {
  list-style: none;
  padding: 0;
}

.mistake-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-light);
  font-size: 0.9rem;
  color: var(--color-mid);
}

.mistake-list li:last-child {
  border-bottom: none;
}

/* Guide Section */
.guide-section {
  padding: 60px 0;
  background: var(--color-white);
}

.guide-section h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin-bottom: 24px;
}

.guide-content {
  max-width: 800px;
}

.guide-content p {
  font-size: 0.95rem;
  color: var(--color-mid);
  margin-bottom: 16px;
  line-height: 1.7;
}

/* Footer */
.site-footer {
  background: var(--color-charcoal);
  color: #ccc;
  padding: 40px 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.footer-inner p {
  font-size: 0.9rem;
}

.footer-inner nav {
  display: flex;
  gap: 20px;
}

.footer-inner nav a {
  color: #ddd;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-inner nav a:hover {
  color: var(--color-warm);
}

.footer-meta {
  font-size: 0.8rem;
  color: #888;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-charcoal);
  color: var(--color-white);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Print styles */
@media print {
  .site-header,
  .site-footer,
  .calc-input-panel,
  .result-actions,
  .scrap-list-controls,
  .preset-grid,
  .btn,
  .remove-btn,
  .toast {
    display: none !important;
  }
  .calc-layout {
    grid-template-columns: 1fr;
  }
  .panel-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }
  body {
    background: white;
  }
}

/* Responsive */
@media (max-width: 900px) {
  .hero-section {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 40px 0;
  }
  .hero-text h1 {
    font-size: 2rem;
  }
  .hero-visual {
    order: -1;
  }
  .scrap-grid {
    width: 180px;
    height: 180px;
  }
  .calc-layout {
    grid-template-columns: 1fr;
  }
  .stash-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .main-nav {
    gap: 12px;
  }
  .main-nav a {
    font-size: 0.85rem;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 0 16px;
  }
  .hero-text h1 {
    font-size: 1.6rem;
  }
  .hero-sub {
    font-size: 1rem;
  }
  .summary-stats {
    grid-template-columns: 1fr;
  }
  .preset-grid {
    grid-template-columns: 1fr;
  }
  .pattern-grid {
    grid-template-columns: 1fr;
  }
  .main-nav {
    display: none;
  }
  .result-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .reference-table {
    font-size: 0.8rem;
  }
  .reference-table th,
  .reference-table td {
    padding: 8px 6px;
  }
}

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

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

/* Scrollbar styling */
.scrap-list::-webkit-scrollbar {
  width: 6px;
}

.scrap-list::-webkit-scrollbar-track {
  background: var(--color-light);
  border-radius: 3px;
}

.scrap-list::-webkit-scrollbar-thumb {
  background: var(--color-mid);
  border-radius: 3px;
}

/* Color chip backgrounds */
.chip-warm { background: #fde0cc; color: #8b4513; }
.chip-cool { background: #d4e4d4; color: #2d5a2d; }
.chip-neutral { background: #e8e4de; color: #5a5550; }
.chip-dark { background: #d0c8c0; color: #1a1a1a; }
.chip-bright { background: #f0d0f0; color: #6a1a6a; }
.chip-earth { background: #e0d8c8; color: #5a4a2a; }
.chip-pastel { background: #f0e0f0; color: #6a4a6a; }
.chip-print { background: #e0e0e0; color: #3a3a3a; }

.chip-warm .color-dot { background: #c47a4a; }
.chip-cool .color-dot { background: #6b8e6b; }
.chip-neutral .color-dot { background: #a09888; }
.chip-dark .color-dot { background: #2d2d2d; }
.chip-bright .color-dot { background: #d040d0; }
.chip-earth .color-dot { background: #8b7a4a; }
.chip-pastel .color-dot { background: #c090c0; }
.chip-print .color-dot { background: #6a6a6a; }


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