/* BuildWise — UI styles, built on web/tokens.css (syntaxweave design language). */

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Result panel is hidden until the user submits (empty state). */
.result-card.hidden { display: none; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 48px 28px 80px;
}

/* ---- Header ---- */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 64px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 26px;
  letter-spacing: 0.5px;
  color: var(--accent);
}
.eyebrow, .card-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--text-faint);
}

/* ---- Hero ---- */
.hero { padding-bottom: 56px; }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(34px, 5.5vw, 60px);
  line-height: 1.08;
  letter-spacing: -0.5px;
}
.hero h1 .accent { color: var(--accent); }
.lede {
  margin-top: 22px;
  max-width: 620px;
  color: var(--text-dim);
  font-size: 17px;
}

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 32px;
  margin-bottom: 28px;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.card-eyebrow { display: block; margin-bottom: 22px; }

/* ---- Form ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.row { display: flex; gap: 24px; }
.row.align-end { align-items: flex-end; }
.field { display: block; margin-bottom: 22px; }
.field.narrow { max-width: 140px; }
.field > span,
.toggle-field > span {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 9px;
}
.field > span .opt { font-style: normal; color: var(--text-faint); font-size: 12px; margin-left: 8px; }

select, textarea, input[type="text"] {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-el);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a8a8b0' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}
textarea { resize: vertical; }
select:focus, textarea:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.12);
}

/* Segmented control */
.segmented {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  padding: 4px;
  gap: 4px;
}
.segmented button {
  border: 0; background: transparent; color: var(--text-dim);
  font-family: var(--font-body); font-size: 14px; cursor: pointer;
  padding: 8px 20px; border-radius: var(--r-pill);
  transition: all 0.3s var(--ease);
}
.segmented button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips button {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-dim);
  font-family: var(--font-body); font-size: 14px; cursor: pointer;
  padding: 8px 18px; border-radius: var(--r-pill);
  transition: all 0.3s var(--ease);
}
.chips button:hover { border-color: rgba(212,165,116,0.4); color: var(--text); }
.chips button.active {
  background: rgba(212,165,116,0.12); border-color: var(--accent); color: var(--accent);
}

/* Toggle switch */
.toggle-field { display: flex; flex-direction: column; }
.switch {
  width: 46px; height: 26px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border-strong);
  position: relative; cursor: pointer; transition: all 0.3s var(--ease);
}
.switch .knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--text-faint); transition: all 0.3s var(--ease);
}
.switch.active { background: rgba(212,165,116,0.18); border-color: var(--accent); }
.switch.active .knob { left: 22px; background: var(--accent); box-shadow: var(--accent-glow); }

/* Dropzone */
.dropzone {
  margin-top: 6px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-el);
  padding: 28px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: all 0.3s var(--ease);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: rgba(212,165,116,0.04); }
.dz-icon { font-size: 22px; color: var(--accent); }
.dz-text { color: var(--text-dim); font-size: 15px; }
.dz-meta { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }

/* CTA */
.cta {
  margin-top: 26px; width: 100%;
  background: var(--accent); color: #1a120a;
  border: 0; border-radius: var(--r-pill); cursor: pointer;
  font-family: var(--font-body); font-weight: 600; font-size: 16px;
  padding: 15px; transition: all 0.3s var(--ease);
}
.cta:hover { box-shadow: 0 0 24px rgba(212,165,116,0.35); transform: translateY(-1px); }

/* ---- Result ---- */
.result-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.reasoning-toggle { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.reasoning-toggle > span { font-size: 13px; color: var(--text-dim); }
.result-card h2 {
  font-family: var(--font-display); font-weight: 400; font-size: 24px;
}
.result-card h3 {
  font-family: var(--font-display); font-weight: 400; font-size: 19px;
  margin: 30px 0 12px;
}
.status-dot {
  width: 11px; height: 11px; border-radius: 50%; background: var(--text-faint);
  flex-shrink: 0;
}
.status-dot.ok { background: #7fc99a; box-shadow: 0 0 12px rgba(127,201,154,0.7); animation: pulse 2.6s var(--ease) infinite; }
.status-dot.block { background: var(--accent); box-shadow: var(--accent-glow); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

.reality, .strategy { color: var(--text-dim); max-width: 680px; }

table.settings { width: 100%; border-collapse: collapse; margin-top: 6px; }
table.settings th {
  text-align: left; font-family: var(--font-mono); font-weight: 500;
  font-size: 11px; letter-spacing: 1.5px; color: var(--text-faint);
  text-transform: uppercase; padding: 10px 14px; border-bottom: 1px solid var(--border-strong);
}
table.settings td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  font-size: 14.5px; vertical-align: top;
}
table.settings td.val {
  font-family: var(--font-mono); color: var(--accent); white-space: nowrap;
}
table.settings td.why { color: var(--text-dim); }

/* Terse mode hides the reasoning */
.result-card.terse .why-col,
.result-card.terse .why { display: none; }
.result-card.terse .strategy,
.result-card.terse .note-head { display: none; }
.result-card.terse .md-section[data-section="strategy-note"] { display: none; }

/* Status label next to the dot */
.status-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-faint);
}

/* Rendered coach markdown */
.result-body .md-section + .md-section { margin-top: 30px; }
.result-body .md-section > h2 { margin-bottom: 12px; }
.result-body p { color: var(--text-dim); max-width: 680px; margin: 10px 0; }
.result-body ul { color: var(--text-dim); margin: 10px 0 10px 20px; }
.result-body li { margin: 4px 0; }
.result-body code {
  font-family: var(--font-mono); font-size: 0.9em; color: var(--accent);
  background: var(--surface); padding: 1px 5px; border-radius: 4px;
}

/* CTA loading state */
.cta.loading { opacity: 0.7; cursor: progress; }
.cta:disabled { cursor: not-allowed; }

/* ---- Footer ---- */
.site-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--border);
}
.site-footer .req { color: var(--accent); text-decoration: none; font-size: 14px; }
.site-footer .req:hover { text-decoration: underline; }
.site-footer .mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .wrap { padding: 32px 18px 60px; }
}

/* ---------- Interaction layer (adapted from syntaxweave) ---------- */

/* Pulsing copper eyebrow dot */
.eyebrow .dot, .card-eyebrow .dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
  margin-right: 9px; vertical-align: middle;
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* Hero parallax target + decode headline */
.hero-inner { will-change: transform; }
.headline .line { display: block; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.in { opacity: 1; transform: translateY(0); }

/* Settings header + copy button */
.settings-head { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 12px; }
.settings-head h3 { margin: 0; }
.copy-btn {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 1px; text-transform: lowercase;
  color: var(--text-dim); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  padding: 6px 14px; cursor: pointer; transition: all 0.3s var(--ease);
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }

/* Tradeoffs "you give up" column stays dim, never hidden */
table.settings td.give { color: var(--text-dim); }

/* Toast */
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--accent); color: var(--bg); padding: 0.85rem 1.5rem;
  font-weight: 500; font-size: 0.85rem; border-radius: var(--r-toast);
  opacity: 0; transition: opacity 0.3s var(--ease), transform 0.4s var(--ease);
  z-index: 1000; pointer-events: none; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Shared button hover language */
.cta:hover { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 0 22px rgba(212, 165, 116, 0.28); }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .eyebrow .dot, .card-eyebrow .dot, .status-dot.ok { animation: none !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-inner { transform: none !important; }
}
