:root {
  /* Elevation ladder (darkest -> lightest) */
  --bg-app: #0A0E13;
  --bg-sunken: #0B0F14;
  --surface-1: #121824;
  --surface-2: #182232;
  --surface-3: #1F2937;
  --hover: #252E3D;

  /* Borders */
  --border-subtle: #1F2937;
  --border-default: #2A3244;
  --border-strong: #3A4458;

  /* Text */
  --text-primary: #E6EAF2;
  --text-secondary: #A2ADBD;
  --text-tertiary: #7C889C;
  --text-muted: #5A6478;

  /* Accents */
  --green: #2FBF71;
  --green-deep: #1FA85E;
  --green-bright: #3AD27F;
  --green-dim: rgba(47,191,113,0.14);
  --amber: #E0A52A;
  --amber-dim: rgba(224,165,42,0.14);
  --red: #E0552A;
  --red-dim: rgba(224,85,42,0.14);

  /* Effects */
  --shadow-md: 0 16px 40px rgba(0,0,0,0.45);
  --raised-inset: inset 0 1px 0 rgba(255,255,255,0.05);

  /* Legacy aliases (kept so nothing breaks) */
  --bg: #0A0E13;
  --surface: #121824;
  --text: #E6EAF2;
  --muted: #A2ADBD;
  --dim: #7C889C;
  --accent: #2FBF71;
  --accent-2: #E0552A;
  --border: #2A3244;
  --shadow: 0 16px 40px rgba(0,0,0,0.45);

  --radius: 2px;
  --maxw: 1120px;
  --font-title: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-primary);
  background:
    linear-gradient(90deg, rgba(42,50,68,0.06) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(0deg, rgba(42,50,68,0.06) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--bg-app);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: min(100% - 32px, var(--maxw));
  margin: 0 auto;
}

/* ---------------- Header ---------------- */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(18, 24, 36, 0.88);
  border-bottom: 1px solid var(--border-default);
  box-shadow: var(--shadow-md), var(--raised-inset);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-title);
  letter-spacing: -0.02em;
}

.brand-badge {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--text-primary);
}

.brand-glyph {
  width: 28px;
  height: 28px;
  display: block;
  color: var(--text-primary);
}

.brand-glyph .prompt {
  stroke: var(--green);
}

.brand-wordmark {
  font-size: 16px;
}

.brand-main {
  font-weight: 700;
}

.brand-sub {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--text-tertiary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-select select {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.lang-select select:focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green-dim);
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 13px;
}

.nav a:hover { color: var(--text-primary); }

/* ---------------- Sections ---------------- */
.section {
  padding: 64px 0;
}

.section--band {
  background: var(--surface-1);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.section-head {
  max-width: 640px;
  margin: 0 0 32px;
}

.section h2 {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: clamp(24px, 2.8vw, 36px);
  letter-spacing: -0.02em;
  margin: 8px 0 12px;
}

.lead {
  color: var(--text-secondary);
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--amber);
}

/* ---------------- Grid / Cards ---------------- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-md), var(--raised-inset);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-family: var(--font-title);
  font-weight: 600;
}

.card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

/* Template cards (link cards) */
.template-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-md), var(--raised-inset);
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}

.template-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
  transform: translateY(-2px);
}

.template-card .tpl-tag {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid rgba(224,165,42,0.3);
  border-radius: var(--radius);
  padding: 3px 8px;
}

.template-card .tpl-title {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
  line-height: 1.3;
}

.template-card .tpl-arrow {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
}

.template-card:hover .tpl-arrow { color: var(--green); }

/* Category row on cards */
.template-card .tpl-cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}
.tpl-cat .ico { width: 15px; height: 15px; flex-shrink: 0; }

/* Filter chips */
.tpl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.chip .ico { width: 15px; height: 15px; flex-shrink: 0; }
.chip:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--surface-3);
}
.chip.active {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-dim);
}

/* Feature icons */
.feat-ico {
  width: 28px;
  height: 28px;
  display: block;
  margin-bottom: 14px;
  color: var(--green);
}

/* Wordmark — green accent on "ai" */
.brand-wm { font-weight: 600; color: var(--text-primary); }
.brand-accent { color: var(--green); }

/* ---------------- Steps ---------------- */
.steps {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.step {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: start;
}

.step-number {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--amber-dim);
  border: 1px solid rgba(224,165,42,0.32);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 16px;
  color: var(--amber);
}

.step h3 {
  margin: 4px 0 6px;
  font-size: 16px;
  font-family: var(--font-title);
  font-weight: 600;
}

.step p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

/* ---------------- Hero ---------------- */
.hero {
  padding: 88px 0 72px;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 48px;
  align-items: center;
}

.hero-copy {
  max-width: 560px;
}

.hero-copy h1 {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: clamp(34px, 4.4vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 14px 0 18px;
}

.hero-copy p {
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.6;
  margin: 0 0 24px;
}

.hero-meta {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease, border-color .15s ease, color .15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #2FBF71, #1FA85E);
  color: #0B0F14;
  border: none;
  box-shadow: var(--shadow-md), var(--raised-inset);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3AD27F, #2FBF71);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover {
  background: var(--hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* ---------------- Hero visual: stylized spreadsheet ---------------- */
.hero-visual {
  display: grid;
  justify-items: end;
}

.sheet {
  width: min(100%, 480px);
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md), var(--raised-inset);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12px;
}

.sheet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-default);
}

.sheet-bar .dots {
  display: flex;
  gap: 6px;
}

.sheet-bar .dots span {
  width: 9px;
  height: 9px;
  border-radius: var(--radius);
  background: var(--border-strong);
  display: block;
}

.sheet-bar .title {
  color: var(--text-tertiary);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.sheet-grid {
  display: grid;
  grid-template-columns: 28px 1.4fr 1fr 1fr;
}

.sheet-grid > div {
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-grid .col-head,
.sheet-grid .row-head {
  background: var(--surface-1);
  color: var(--text-tertiary);
  text-align: center;
}

.sheet-grid .col-head { font-weight: 500; }

.sheet-grid .cell {
  background: var(--bg-sunken);
  color: var(--text-secondary);
}

.sheet-grid .cell.fname { color: var(--text-primary); }

.sheet-grid .cell.selected {
  border: 1px solid var(--green);
  box-shadow: inset 0 0 0 1px var(--green-dim);
}

.cell-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.cell-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: var(--radius);
  flex: none;
}

.cell-status.done { color: var(--green); }
.cell-status.done::before { background: var(--green); }

.cell-status.processing { color: var(--amber); }
.cell-status.processing::before {
  background: var(--amber);
  animation: cell-pulse 1.3s ease-in-out infinite;
}

.cell-status.pending { color: var(--text-muted); }
.cell-status.pending::before { background: var(--text-muted); }

@keyframes cell-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--amber-dim); }
  50% { opacity: 0.55; box-shadow: 0 0 0 4px var(--amber-dim); }
}

@media (prefers-reduced-motion: reduce) {
  .cell-status.processing::before { animation: none; }
}

/* ---------------- Footer ---------------- */
.footer {
  margin-top: auto;
  padding: 48px 0 40px;
  border-top: 1px solid var(--border-default);
  background: var(--surface-1);
  color: var(--text-tertiary);
  font-size: 13px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(auto-fit, minmax(140px, 1fr));
  gap: 32px;
}

.footer-brand .brand {
  margin-bottom: 10px;
}

.footer-tagline {
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 1.6;
  max-width: 320px;
  margin: 0;
}

.footer-col h4 {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--amber);
  margin: 0 0 12px;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.footer-col a {
  color: var(--text-secondary);
  font-size: 13px;
}

.footer-col a:hover { color: var(--text-primary); }

.footer-copy {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------------- Template page styles (shared) ---------------- */
.template-hero {
  padding: 64px 0 28px;
}

.template-hero h1 {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 46px);
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-mono);
}

.meta-pill {
  padding: 6px 10px;
  border: 1px solid rgba(224,165,42,0.3);
  border-radius: var(--radius);
  background: var(--amber-dim);
  color: var(--amber);
  box-shadow: var(--raised-inset);
}

.io-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.io-card {
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-md), var(--raised-inset);
}

.io-card h4 {
  margin: 0 0 8px;
  font-family: var(--font-title);
  font-weight: 600;
}

.code-sample {
  font-family: var(--font-mono);
  background: var(--bg-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.35);
}

.faq {
  display: grid;
  gap: 12px;
}

.faq-item {
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface-2);
  box-shadow: var(--shadow-md), var(--raised-inset);
}

@media (max-width: 720px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .hero { padding-top: 56px; }
  .hero-visual { justify-items: stretch; }
  .sheet { width: 100%; }
}
