@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800&family=Geist+Mono:wght@400;500;700&display=swap');

:root {
  --bg-color: #fafafa;
  --bg-grid: rgba(150, 150, 150, 0.04);
  --surface-color: #ffffff;
  --surface-muted: #f4f4f5;
  --surface-soft: #f8f8f8;
  --border-color: #969696;
  --border-muted: #e4e4e7;
  --text-primary: #27272a;
  --text-secondary: #52525b;
  --text-muted: #8d8d96;
  --accent-color: #ff5a00;
  --accent-dark: #3f3f46;
  --success-bg: #edf4ee;
  --warning-bg: #fff4e8;
  --error-bg: #fff0ee;
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  --shadow-hard: 6px 6px 0 rgba(150, 150, 150, 0.14);
  --shadow-soft: 4px 4px 0 rgba(150, 150, 150, 0.1);
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Geist Mono", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    var(--bg-color);
  background-size: 30px 30px, 30px 30px, auto;
  color: var(--text-primary);
  font: 16px/1.62 var(--font-sans);
}

body {
  min-height: 100vh;
}

a {
  color: var(--accent-dark);
}

input,
textarea,
select,
button {
  font: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 30px));
  margin: 18px auto 48px;
}

.hero,
.card,
.summary-tile,
.discovery-item,
.recommendation-block,
.export-item,
.overlay__card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--surface-color);
}

.hero {
  position: relative;
  padding: 28px;
  box-shadow: var(--shadow-hard);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid var(--border-muted);
  pointer-events: none;
}

.hero__topline {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.hero__badge,
.chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--accent-color);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero__microcopy {
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.hero__copy {
  position: relative;
  z-index: 1;
  margin-top: 22px;
  display: grid;
  gap: 16px;
}

.hero h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.9rem, 5vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  text-transform: uppercase;
}

.hero__lead {
  max-width: 54ch;
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.08rem;
}

.hero__lead strong,
.hero__bullet strong {
  color: var(--text-primary);
}

.hero__bullets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.hero__bullet {
  min-height: 100%;
  padding: 16px;
  border: 1px solid var(--border-muted);
  background: var(--surface-muted);
  box-shadow: var(--shadow-soft);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.56;
}

.intake-card {
  margin-top: 8px;
  padding: 24px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  box-shadow: var(--shadow-soft);
}

.intake-card__head h2,
.card__head h2,
.summary-tile h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 1.9rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.intake-card__head p,
.card__head p,
.summary-tile p,
.exports-toolbar__note,
.placeholder,
.discovery-item__content,
.recommendation-block p,
.intake-card__footnote,
.field__help,
.overlay__hint {
  color: var(--text-secondary);
}

.intake-card__head p,
.card__head p,
.summary-tile p,
.intake-card__footnote,
.exports-toolbar__note {
  margin: 8px 0 0;
}

.form-stack {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 8px;
}

.field__label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.field__help {
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-primary);
  padding: 14px 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

textarea {
  resize: vertical;
  min-height: 108px;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 3px 3px 0 rgba(255, 90, 0, 0.12);
}

.actions,
.exports-toolbar__actions,
.export-item__tools,
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  background: var(--surface-color);
  color: var(--text-primary);
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(150, 150, 150, 0.16);
}

.btn--primary {
  background: var(--accent-dark);
  color: #fff;
}

.btn--ghost {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.btn--small {
  padding: 10px 14px;
  font-size: 13px;
}

.btn--loading {
  position: relative;
  pointer-events: none;
  opacity: 0.82;
  padding-left: 40px;
}

.btn--loading::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.status-box {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.status-box--idle {
  background: var(--surface-soft);
}

.status-box--working {
  background: #f6efe9;
  border-color: #d5a98d;
}

.status-box--success {
  background: var(--success-bg);
  border-color: #b8cdb8;
}

.status-box--warning {
  background: var(--warning-bg);
  border-color: #d8b38b;
}

.status-box--error {
  background: var(--error-bg);
  border-color: #d6a29a;
}

.status-box__text {
  display: inline-flex;
  align-items: center;
}

.intake-card__footnote {
  padding-top: 14px;
  border-top: 1px solid var(--border-muted);
  font-size: 13px;
}

.results-shell {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.summary-tile {
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-soft);
}

.summary-tile__kicker {
  color: var(--accent-color);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.summary-tile h2 {
  margin: 10px 0 6px;
}

.analysis-flow {
  display: grid;
  gap: 20px;
}

.card {
  position: relative;
  padding: 24px;
  box-shadow: var(--shadow-hard);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 64px;
  height: 3px;
  background: var(--accent-color);
}

.card--secondary {
  background: #fff;
}

.discovery-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.discovery-item,
.recommendation-block {
  padding: 16px 18px;
  box-shadow: var(--shadow-soft);
}

.discovery-item__title,
.recommendation-block h3,
.export-item__title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  line-height: 1.2;
}

.discovery-item__content {
  font-size: 14px;
}

.discovery-item__content ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.module-recommendations,
.exports-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.exports-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 24px;
  align-items: center;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  background: var(--surface-muted);
  box-shadow: var(--shadow-soft);
}

.exports-toolbar__content {
  display: grid;
  gap: 12px;
}

.exports-toolbar__actions {
  align-items: center;
}

.exports-toolbar__primary .btn {
  min-width: 228px;
}

.exports-toolbar__module-link {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.exports-toolbar__module-link:hover {
  color: var(--accent-dark);
}

.exports-toolbar__note {
  font-size: 13px;
}

.export-item {
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.export-item[open] {
  box-shadow: var(--shadow-hard);
}

.export-item__summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  list-style: none;
  padding: 18px;
  cursor: pointer;
  background: #fff;
}

.export-item__summary::-webkit-details-marker {
  display: none;
}

.export-item__summary-main {
  min-width: 0;
}

.export-item__hint {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.export-item__state {
  flex: none;
  color: var(--accent-color);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.export-item__body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--border-muted);
  background: var(--surface-soft);
}

.export-item__tools {
  justify-content: flex-end;
  margin: 14px 0 10px;
}

.export-item__textarea {
  min-height: 148px;
  background: #fff;
  font-family: var(--font-mono);
  font-size: 13px;
}

.preview-box {
  margin: 18px 0 0;
  padding: 20px;
  border: 1px solid var(--border-color);
  background: #101013;
  color: #e7e7ea;
  overflow: auto;
  white-space: pre-wrap;
  box-shadow: var(--shadow-soft);
  font-family: var(--font-mono);
}

.placeholder {
  padding: 20px;
  border: 1px dashed var(--border-color);
  background: var(--surface-soft);
}

.preview-cta {
  margin-top: 16px;
  padding: 14px 18px;
  border: 1px solid var(--border-color);
  background: var(--surface-soft);
  font-size: 14px;
}

.preview-cta a {
  color: var(--accent-dark);
  font-weight: 600;
  white-space: nowrap;
}

.chip-list {
  gap: 8px;
}

.chip {
  color: var(--accent-dark);
  letter-spacing: 0.02em;
  text-transform: none;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-muted);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
  flex-shrink: 0;
}

.status-box--working {
  animation: pulse 1.8s ease-in-out infinite;
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f1 25%, #e1e1e4 50%, #f0f0f1 75%);
  background-size: 400px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton--text {
  height: 14px;
  margin-bottom: 10px;
  width: 100%;
}

.skeleton--text-short {
  height: 14px;
  margin-bottom: 10px;
  width: 60%;
}

.skeleton--title {
  height: 20px;
  margin-bottom: 14px;
  width: 40%;
}

.skeleton--block {
  min-height: 80px;
  border: 1px solid var(--border-color);
}

.skeleton--card {
  min-height: 140px;
  padding: 18px;
  display: grid;
  gap: 10px;
}

.card--fade {
  animation: fadeIn 0.45s ease-out both;
}

.card--fade:nth-child(1) { animation-delay: 0s; }
.card--fade:nth-child(2) { animation-delay: 0.06s; }
.card--fade:nth-child(3) { animation-delay: 0.12s; }
.card--fade:nth-child(4) { animation-delay: 0.18s; }
.card--fade:nth-child(5) { animation-delay: 0.24s; }
.card--fade:nth-child(6) { animation-delay: 0.30s; }
.card--fade:nth-child(7) { animation-delay: 0.36s; }
.card--fade:nth-child(8) { animation-delay: 0.42s; }
.card--fade:nth-child(9) { animation-delay: 0.48s; }
.card--fade:nth-child(10) { animation-delay: 0.54s; }

.preview-box--loading {
  animation: shimmer 1.5s ease-in-out infinite;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 16, 19, 0.76);
  animation: overlayIn 0.28s ease-out both;
}

.overlay[hidden] {
  display: none;
}

.overlay__card {
  position: relative;
  width: min(420px, calc(100% - 40px));
  padding: 42px 30px;
  box-shadow: 10px 10px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
  animation: cardReveal 0.4s 0.08s ease-out both;
}

.overlay__orb,
.overlay__ring {
  display: none;
}

.overlay__content {
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
}

.overlay__spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border-muted);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.overlay__title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
}

.overlay__hint {
  margin: 0;
  max-width: 300px;
  font-size: 15px;
}

.floating-download {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--accent-dark);
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
  box-shadow: var(--shadow-hard);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
  animation: fadeIn 0.4s ease-out both;
}

.floating-download[hidden] {
  display: none;
}

.floating-download:hover {
  transform: translate(calc(-2px), calc(-50% - 2px));
}

.floating-download__icon {
  font-size: 18px;
  line-height: 1;
}

.floating-download__label {
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 960px) {
  .page-shell {
    width: min(100% - 22px, 100%);
  }

  .hero__bullets,
  .summary-strip,
  .discovery-grid {
    grid-template-columns: 1fr;
  }

  .floating-download {
    right: 10px;
    padding: 12px 10px;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 14px, 100%);
    margin: 8px auto 24px;
  }

  .hero,
  .card,
  .intake-card,
  .summary-tile,
  .discovery-item,
  .recommendation-block,
  .export-item {
    box-shadow: none;
  }

  .hero,
  .card,
  .intake-card {
    padding: 18px;
  }

  .hero::before {
    inset: 10px;
  }

  .hero h1 {
    max-width: none;
    font-size: 2.55rem;
  }

  .hero__topline,
  .export-item__summary,
  .actions,
  .exports-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .exports-toolbar__actions {
    width: 100%;
    flex-direction: column;
  }

  .exports-toolbar__primary,
  .exports-toolbar__secondary,
  .exports-toolbar__primary .btn,
  .exports-toolbar__secondary .btn {
    width: 100%;
  }

  .export-item__tools {
    justify-content: stretch;
  }

  .btn,
  .btn--small {
    width: 100%;
  }

  .hero__lead {
    font-size: 1rem;
  }

  .floating-download {
    right: 8px;
    top: auto;
    bottom: 14px;
    transform: none;
    flex-direction: row;
    padding: 12px 14px;
  }

  .floating-download:hover {
    transform: translateY(-2px);
  }
}
