/* StitchFix – Home Machine Tension Troubleshooter */
:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f4ede3;
  --ink: #2a2118;
  --ink-soft: #5b4f40;
  --muted: #8a7c68;
  --line: #e3d6c4;
  --accent: #b5472b;
  --accent-2: #d97a4a;
  --accent-soft: #f6e3d6;
  --good: #3f7a4a;
  --warn: #b5822b;
  --bad: #b5472b;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(42,33,24,0.04), 0 12px 30px rgba(42,33,24,0.06);
  --max: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, #f6e3d6 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 20%, #efe6d7 0%, transparent 55%),
    var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(251,247,242,0.85);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.brand-mark { color: var(--accent); }
.brand-text { font-size: 1.1rem; }
.site-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
  padding: 48px 0 24px;
  align-items: start;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 10px;
}
.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.lede { font-size: 1.05rem; color: var(--ink-soft); margin: 0 0 20px; max-width: 56ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.hero-card h2 { margin: 0 0 12px; font-size: 1.1rem; }
.check-list { margin: 0; padding: 0; list-style: none; }
.check-list li {
  position: relative;
  padding: 8px 0 8px 28px;
  border-bottom: 1px dashed var(--line);
  color: var(--ink-soft);
}
.check-list li:last-child { border-bottom: 0; }
.check-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 12px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
}
.check-list li::after {
  content: "";
  position: absolute;
  left: 5px; top: 16px;
  width: 6px; height: 10px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #9a3c24; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }

/* Diagnose layout */
.diagnose { padding: 24px 0 40px; }
.layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 24px;
  align-items: start;
}
.panel, .result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-head, .result-head {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-head h2, .result-head h2 { margin: 0; font-size: 1.2rem; }
.panel-head .muted { margin: 0; font-size: 0.9rem; }

.presets {
  padding: 14px 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.presets-label { font-size: 0.85rem; color: var(--muted); margin-right: 4px; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.form { padding: 18px 22px 22px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; }
select, input[type="text"], input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.95rem;
  font-family: inherit;
}
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 700; font-size: 0.95rem; margin-bottom: 10px; padding: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.symptom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sym {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  font-size: 0.92rem;
}
.sym:hover { border-color: var(--accent); }
.sym input { accent-color: var(--accent); }

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

/* Result */
.result { position: sticky; top: 80px; }
.tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
}
.stitch-viz {
  padding: 16px 22px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.fabric-line { stroke: #c9b89c; stroke-width: 1; }
.stitch-path { stroke: var(--accent); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.viz-caption { margin: 8px 0 0; font-size: 0.85rem; color: var(--ink-soft); text-align: center; }
.result-body { padding: 18px 22px 22px; }
.verdict h3, .checks h3, .next h3 { margin: 0 0 8px; font-size: 1rem; color: var(--ink); }
.verdict p { margin: 0 0 16px; color: var(--ink-soft); }

.dials {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.dial {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}
.dial-label { display: block; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.dial-value { display: block; font-size: 1.2rem; font-weight: 700; color: var(--accent); margin-top: 4px; }

.checks, .next { margin-top: 16px; }
.checks ul, .next ol { margin: 0; padding-left: 20px; color: var(--ink-soft); }
.checks li, .next li { margin-bottom: 6px; }
.result-foot { padding: 10px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* History */
.history { padding: 30px 0; }
.history h2 { margin: 0 0 6px; }
.history-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.history-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.history-item .meta { font-size: 0.85rem; color: var(--ink-soft); }
.history-item .meta strong { color: var(--ink); }
.history-item .tag-sm { font-size: 0.72rem; background: var(--accent-soft); color: var(--accent); padding: 3px 8px; border-radius: 999px; font-weight: 700; }
.history-empty { color: var(--muted); font-style: italic; padding: 10px 0; }

/* Reference */
.reference, .mistakes, .stretch { padding: 30px 0; }
.reference h2, .mistakes h2, .stretch h2 { margin: 0 0 14px; }
.reference p, .stretch p { color: var(--ink-soft); max-width: 72ch; }
.ref-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 20px 0; }
.ref-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.ref-card h3 { margin: 0 0 8px; font-size: 1rem; }
.ref-card p { margin: 0; font-size: 0.95rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ref-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.92rem; }
.ref-table th, .ref-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.ref-table th { background: var(--surface-2); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.ref-table tr:last-child td { border-bottom: 0; }

.mistake-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.mistake-list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--ink-soft);
}
.mistake-list strong { color: var(--ink); }

/* Footer */
.site-footer {
  margin-top: 40px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px;
  flex-wrap: wrap;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.footer-row nav { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-row a { color: var(--ink-soft); text-decoration: none; }
.footer-row a:hover { color: var(--accent); }

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* Print */
@media print {
  .site-header, .site-footer, .hero, .presets, .form-actions, .history, .mistakes, .stretch, .site-nav { display: none !important; }
  .diagnose { padding: 0; }
  .layout { grid-template-columns: 1fr; }
  .result { position: static; box-shadow: none; border: 0; }
  .panel { display: none; }
  .result-body { padding: 0; }
  .result-foot { border: 0; padding: 0; margin-top: 10px; }
  body { background: #fff; }
}

/* Responsive */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .result { position: static; }
  .grid-2 { grid-template-columns: 1fr; }
  .symptom-grid { grid-template-columns: 1fr; }
  .dials { grid-template-columns: 1fr; }
  .header-row { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) {
  .hero h1 { font-size: 1.8rem; }
  .form { padding: 14px; }
  .panel-head, .result-head { padding: 14px; }
  .result-body { padding: 14px; }
}



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