/* YarnSwap Styles */
:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-alt: #f3efe8;
  --text: #2c2420;
  --text-light: #6b5e56;
  --border: #e0d8cf;
  --accent: #6b4c9a;
  --accent-hover: #5a3d87;
  --accent-light: #f0ebf7;
  --success: #3a8c6e;
  --success-light: #e8f5f0;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
  --max-width: 1160px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  white-space: nowrap;
}
.logo:hover { text-decoration: none; color: var(--accent-hover); }

.site-nav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
}
.site-nav a {
  font-size: 0.9rem;
  color: var(--text-light);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); text-decoration: none; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}
.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.mobile-menu a {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.95rem;
}
.mobile-menu a:hover { background: var(--surface-alt); color: var(--accent); }
.mobile-menu:not([hidden]) { display: flex; }

/* Layout Grid */
.layout-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}

/* Finder Panel */
.finder-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.finder-panel h1 {
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
}
.finder-tagline {
  color: var(--text-light);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Form */
.finder-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.form-row label {
  font-weight: 600;
  font-size: 0.85rem;
}
.field-hint {
  font-weight: 400;
  color: var(--text-light);
  font-size: 0.8rem;
}
select, input[type="number"] {
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(107,76,154,0.15);
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding-top: 0.25rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--border); }

/* Results */
.results-area { min-height: 80px; }
.results-placeholder {
  background: var(--surface-alt);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  background: var(--bg);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: start;
}
.result-card h3 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}
.result-meta {
  font-size: 0.82rem;
  color: var(--text-light);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.result-meta span::before {
  content: '•';
  margin-right: 0.35rem;
  color: var(--border);
}
.result-meta span:first-child::before { content: none; }
.result-note {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.5rem;
  grid-column: 1 / -1;
}
.result-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.result-actions button {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.result-actions button:hover { background: var(--accent-light); border-color: var(--accent); }
.result-actions button.save-btn { border-color: var(--success); color: var(--success); }
.result-actions button.save-btn:hover { background: var(--success-light); }

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.results-header h2 {
  font-size: 1.1rem;
}
.results-toolbar {
  display: flex;
  gap: 0.5rem;
}
.results-toolbar button {
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font);
}
.results-toolbar button:hover { background: var(--accent-light); border-color: var(--accent); }

.no-results {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
}
.no-results strong { display: block; margin-bottom: 0.5rem; color: var(--text); }

/* Context Panel */
.context-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 4rem;
}
.context-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.context-card h2 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}
.context-card p, .context-card li {
  font-size: 0.88rem;
  color: var(--text-light);
  line-height: 1.55;
}
.context-card ul {
  padding-left: 1.1rem;
  margin-top: 0.5rem;
}
.context-card li { margin-bottom: 0.3rem; }

.presets {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.preset-btn {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.preset-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* Info Sections */
.info-section {
  padding: 3rem 0;
}
.info-section.alt-bg {
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.info-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.info-inner h2 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.steps-list {
  padding-left: 1.2rem;
  margin-bottom: 2rem;
}
.steps-list li {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.55;
}
.steps-list li strong { color: var(--text); }

.scenario-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.scenario-block h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}
.scenario-block p {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.55;
}

.faq-list dt {
  font-weight: 600;
  margin-top: 1.25rem;
  font-size: 0.95rem;
}
.faq-list dd {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: 0.3rem;
  line-height: 1.55;
}

/* Project Lists */
.project-lists {
  margin-top: 1rem;
}
.project-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.project-group h3 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}
.project-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  gap: 0.5rem;
}
.project-item:last-child { border-bottom: none; }
.project-item-name { flex: 1; }
.project-item-remove {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-light);
  font-family: var(--font);
}
.project-item-remove:hover { background: #fce8e8; border-color: #c0392b; color: #c0392b; }

.empty-state {
  color: var(--text-light);
  font-size: 0.9rem;
  padding: 1rem 0;
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2rem 1.25rem;
  margin-top: 2rem;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.5;
}
.footer-brand { margin-bottom: 0.5rem; }
.footer-version { color: var(--border); margin-left: 0.5rem; }
.footer-links { display: flex; gap: 1rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.footer-links a { color: var(--text-light); }
.footer-links a:hover { color: var(--accent); }
.footer-note a { color: var(--accent); }

/* Responsive */
@media (max-width: 860px) {
  .layout-grid {
    grid-template-columns: 1fr;
    padding: 1.25rem;
  }
  .context-panel {
    position: static;
    order: 2;
  }
  .finder-panel { order: 1; }
  .site-nav { display: none; }
  .nav-toggle { display: block; margin-left: auto; }
  .finder-form { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .finder-panel { padding: 1.25rem; }
  .result-card { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
  .form-actions button { width: 100%; }
}

/* Print */
@media print {
  .site-header, .site-footer, .context-panel, .form-actions, .results-toolbar, .result-actions { display: none; }
  .finder-panel { box-shadow: none; border: none; padding: 0; }
  .result-card { break-inside: avoid; }
  body { background: #fff; }
}

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



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