/* ─── Design tokens ─────────────────────────────────────────────── */
:root {
  --bg:       #f7f1e8;
  --card:     #fffaf2;
  --ink:      #171412;
  --muted:    #665f58;
  --line:     #e7dccd;
  --orange:   #ff4d00;
  --plum:     #5c0033;
  --green:    #d9efcf;
  --shadow:   0 24px 80px rgba(34, 25, 18, 0.10);
  --shadow-s: 0 8px 28px rgba(34, 25, 18, 0.08);
  --radius:   28px;
  --radius-s: 16px;
}

/* ─── Reset & base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 80% 10%, rgba(255, 77, 0, 0.10), transparent 26%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  line-height: 1.6;
}

/* ─── Layout ────────────────────────────────────────────────────── */
.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

/* ─── Nav ───────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
}
.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.spark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--orange);
  color: white;
  border-radius: 10px;
  font-size: 16px;
}
.nav-links { display: flex; gap: 24px; align-items: center; font-size: 14px; }
.nav-links a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  color: var(--ink) !important;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  background: #fff8ee;
}

/* ─── Hero ──────────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 52px;
  align-items: start;
  min-height: 650px;
  padding: 44px 0 72px;
}
.eyebrow {
  color: var(--orange);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.09em;
  font-size: 13px;
  margin: 0 0 16px;
}
h1, h2 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 0;
}
h1 { font-size: clamp(52px, 7vw, 100px); max-width: 780px; }
h2 { font-size: clamp(40px, 5vw, 68px); }
h1 span, h2 span { color: var(--orange); }
.subhead {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
  max-width: 640px;
  margin: 24px 0 32px;
}

/* ─── Form card ─────────────────────────────────────────────────── */
.input-card {
  background: rgba(255, 250, 242, .92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  max-width: 760px;
}
.form-row { margin-bottom: 16px; }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
label {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.req { color: var(--orange); }
input[type="url"],
input[type="text"],
select {
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 14px 16px;
  font: inherit;
  font-size: 15px;
  background: white;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 77, 0, 0.12);
}
select { cursor: pointer; }

button[type="submit"] {
  width: 100%;
  border: 0;
  border-radius: var(--radius-s);
  background: var(--orange);
  color: white;
  font-weight: 800;
  font-size: 16px;
  padding: 18px 28px;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(255, 77, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  transition: opacity 0.2s, transform 0.15s;
  letter-spacing: -0.01em;
}
button[type="submit"]:hover { opacity: 0.9; transform: translateY(-1px); }
button[type="submit"]:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-icon { font-size: 14px; }
.helper {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  margin: 12px 0 0;
}

/* ─── Hero panel ────────────────────────────────────────────────── */
.hero-panel {
  background: var(--plum);
  color: white;
  border-radius: 34px;
  padding: 26px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 24px;
}
.panel-top {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 28px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: rgba(255,255,255,.38);
}
.panel-label {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.55);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.mini-workflow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 24px;
}
.step {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  padding: 12px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
}
.step.active { background: rgba(255,255,255,.22); }
.step.accent { background: var(--orange); border-color: var(--orange); }
.arrow { color: rgba(255,255,255,.45); text-align: center; font-size: 18px; }
.score-card {
  background: #fffaf2;
  color: var(--ink);
  border-radius: var(--radius);
  padding: 22px;
  margin: 0 0 16px;
}
.score-card p {
  color: var(--orange);
  font-weight: 800;
  margin: 0 0 6px;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
}
.score-card h3 {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.1;
  margin: 0 0 8px;
}
.score-card span { color: var(--muted); font-size: 13px; }
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.metrics-grid div {
  background: rgba(255,255,255,.12);
  border-radius: 18px;
  padding: 16px 12px;
  text-align: center;
}
.metrics-grid strong { display: block; font-size: 28px; }
.metrics-grid span { color: rgba(255,255,255,.65); font-size: 12px; }
.panel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.panel-tags span {
  background: rgba(255,255,255,.14);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
}

/* ─── How it works ──────────────────────────────────────────────── */
.references, .results-wrap { padding: 72px 0; }
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
}
.reference-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.reference-grid article {
  background: rgba(255, 250, 242, .9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-s);
}
.reference-grid span {
  color: var(--orange);
  font-size: 32px;
  font-family: "Instrument Serif", Georgia, serif;
}
.reference-grid h3 { font-size: 22px; margin: 10px 0; }
.reference-grid p { color: var(--muted); line-height: 1.6; margin: 0; }

/* ─── States ────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.empty-state {
  text-align: center;
  border-radius: var(--radius);
  padding: 64px 44px;
  background: rgba(255, 250, 242, .9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-s);
}
.empty-icon {
  font-size: 40px;
  color: var(--orange);
  margin-bottom: 16px;
  display: block;
}
.empty-state h3 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: 32px;
  margin: 0 0 14px;
}
.empty-state p { color: var(--muted); max-width: 540px; margin: 0 auto; }

.loading-state {
  text-align: center;
  border-radius: var(--radius);
  padding: 64px 44px;
  background: rgba(255, 250, 242, .9);
  border: 1px solid var(--line);
}
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--line);
  border-top-color: var(--orange);
  border-radius: 50%;
  margin: 0 auto 18px;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state p { color: var(--muted); margin: 0 0 16px; font-size: 16px; }
.loading-steps { display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 13px; }
.ls { color: rgba(102, 95, 88, 0.45); transition: color 0.4s; }
.ls.active { color: var(--orange); font-weight: 700; }
.ls-sep { color: rgba(102, 95, 88, 0.3); }

.error-state {
  text-align: center;
  border-radius: var(--radius);
  padding: 44px;
  background: #fff5f3;
  border: 1px solid #ffd4c8;
}
#errorMsg { color: #8d1f00; margin: 0 0 18px; font-size: 15px; }
.retry-btn {
  border: 1px solid var(--orange);
  background: transparent;
  color: var(--orange);
  border-radius: 99px;
  padding: 10px 24px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
}
.retry-btn:hover { background: var(--orange); color: white; }

/* ─── Result / tabs ─────────────────────────────────────────────── */
.result-wrap {
  background: rgba(255, 250, 242, .9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: #fffaf2;
}
.result-label {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--orange);
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-label::before { content: "●"; color: #3cb95e; font-size: 10px; }
.copy-all-btn {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 99px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.copy-all-btn:hover { background: #fff0e6; border-color: var(--orange); color: var(--orange); }

/* Tab bar */
.tab-bar {
  display: flex;
  overflow-x: auto;
  gap: 0;
  border-bottom: 1px solid var(--line);
  background: #fffaf2;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  flex-shrink: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 14px 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
  letter-spacing: -0.01em;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn[aria-selected="true"] {
  color: var(--orange);
  border-bottom-color: var(--orange);
}

/* Tab panels */
.tab-panels { padding: 0; }
.tab-panel {
  display: none;
  padding: 32px 32px 40px;
  animation: fadeIn 0.2s ease;
}
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.panel-title {
  color: var(--orange);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0;
}
.copy-btn {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.copy-btn:hover { border-color: var(--orange); color: var(--orange); }
.copy-btn.copied { background: var(--green); border-color: #3cb95e; color: #1a6b30; }

/* Markdown content rendering */
.md-content { color: #24201c; line-height: 1.7; }
.md-content h1,
.md-content h2,
.md-content h3 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.03em;
  margin: 28px 0 10px;
  line-height: 1.1;
}
.md-content h1 { font-size: 36px; }
.md-content h2 { font-size: 28px; color: var(--ink); }
.md-content h3 { font-size: 22px; color: var(--ink); }
.md-content p { margin: 0 0 14px; }
.md-content ul, .md-content ol { margin: 0 0 14px; padding-left: 22px; }
.md-content li { margin-bottom: 6px; }
.md-content strong { font-weight: 700; color: var(--ink); }
.md-content em { font-style: italic; }
.md-content code {
  background: #f0e8d8;
  border-radius: 6px;
  padding: 2px 7px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
}
.md-content blockquote {
  border-left: 3px solid var(--orange);
  margin: 18px 0;
  padding: 10px 16px;
  color: var(--muted);
  font-style: italic;
}
.md-content hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

/* ─── Footer ────────────────────────────────────────────────────── */
.footer {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--line);
  margin-top: 24px;
}
.footer a { color: var(--orange); text-decoration: none; font-weight: 600; }

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .hero { grid-template-columns: 1fr; min-height: auto; gap: 36px; }
  .hero-panel { position: static; }
  .form-row.two-col { grid-template-columns: 1fr; }
  .reference-grid { grid-template-columns: 1fr; }
  .section-heading { display: block; }
  .mini-workflow { grid-template-columns: 1fr auto 1fr; }
  .mini-workflow .step:last-child,
  .mini-workflow .arrow:last-of-type { display: none; }
  .tab-panel { padding: 24px 20px 32px; }
}

@media (max-width: 560px) {
  h1 { font-size: 48px; }
  h2 { font-size: 36px; }
  .empty-state h3 { font-size: 24px; }
  .panel-header { flex-direction: column; gap: 10px; }
}
