:root {
  --page-bg: #f5efe4;
  --surface: rgba(255, 252, 246, 0.9);
  --surface-strong: #fffaf1;
  --ink: #211c14;
  --muted: #6a6256;
  --line: rgba(33, 28, 20, 0.12);
  --accent: #b44c21;
  --accent-deep: #7f2e0e;
  --success: #2d7a51;
  --danger: #a33424;
  --shadow: 0 24px 80px rgba(81, 51, 25, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(180, 76, 33, 0.14), transparent 26%),
    radial-gradient(circle at top right, rgba(45, 122, 81, 0.12), transparent 22%),
    linear-gradient(180deg, #f8f2e8 0%, #f3ebdf 100%);
  font-family: Georgia, "Times New Roman", serif;
}

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

code {
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(33, 28, 20, 0.06);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9em;
}

.site-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.site-header,
.demo-toolbar {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}

.site-header {
  padding: 16px 0 28px;
}

.brand-mark {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

.brand-mark__eyebrow,
.hero__kicker,
.section-heading__eyebrow,
.service-card__eyebrow,
.blog-card__meta,
.field-label {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
}

.brand-mark__name {
  font-size: 1.25rem;
  font-weight: 700;
}

.site-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav__link {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--muted);
}

.site-nav__link:hover,
.site-nav__link.is-active {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 250, 241, 0.85);
}

.hero__copy,
.service-card,
.content-card,
.blog-card,
.light-card,
.summary-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero__copy {
  padding: 40px;
  border-radius: var(--radius-xl);
}

.hero h1 {
  margin: 0;
  max-width: 10ch;
  line-height: 1.05;
  font-size: clamp(2.8rem, 6vw, 5.4rem);
}

.hero__text,
.section-heading__desc,
.service-card p,
.blog-card p,
.markdown-body,
.service-facts,
.demo-toolbar__text,
.fact-list,
.empty-state {
  color: var(--muted);
  line-height: 1.7;
}

.section-block,
.blog-grid,
.content-grid {
  margin-top: 28px;
}

.service-grid,
.blog-grid,
.demo-split,
.content-grid,
.dali-grid,
.summary-strip {
  display: grid;
  gap: 18px;
}

.service-grid,
.blog-grid,
.dali-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.content-grid {
  grid-template-columns: 1.6fr 0.8fr;
}

.demo-split {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.summary-strip {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-bottom: 18px;
}

.service-card,
.content-card,
.blog-card,
.light-card,
.summary-card {
  padding: 24px;
}

.service-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.text-input,
.input-area {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(33, 28, 20, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font: inherit;
}

.input-area {
  min-height: 180px;
  resize: vertical;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

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

.primary-button,
.light-card__actions button {
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
}

.primary-button,
.light-card__actions button[data-action="set"] {
  background: var(--accent);
  color: #fff7f0;
}

.connection-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(163, 52, 36, 0.12);
  color: var(--danger);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.connection-pill.is-online {
  background: rgba(45, 122, 81, 0.12);
  color: var(--success);
}

.light-card.is-offline {
  opacity: 0.62;
}

.light-card.is-fault-flash {
  animation: fault-flash 1.4s ease-in-out infinite;
  border-color: rgba(200, 50, 40, 0.6);
}

.light-card.is-setting {
  animation: setting-flash 0.5s ease-out forwards;
  border-color: rgba(80, 160, 255, 0.7);
  box-shadow: 0 0 10px rgba(80, 160, 255, 0.35);
}

@keyframes fault-flash {
  0%, 100% { background: rgba(200, 50, 40, 0.08); }
  50% { background: rgba(200, 50, 40, 0.28); }
}

@keyframes setting-flash {
  0% { background: rgba(80, 160, 255, 0.3); }
  100% { background: transparent; }
}

.light-card__header,
.light-card__actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(33, 28, 20, 0.08);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.badge.is-green {
  background: rgba(45, 122, 81, 0.14);
  color: var(--success);
}

.badge.is-red {
  background: rgba(163, 52, 36, 0.12);
  color: var(--danger);
}

.light-card__value {
  margin: 12px 0 16px;
  font-size: 3rem;
  line-height: 1;
}

.light-card.is-setting .light-card__value {
  color: rgba(80, 160, 255, 1);
  transition: color 0.1s;
}

/* ─── Quay Crane ─────────────────────────────────── */

.qc-section-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.qc-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.qc-tab:hover {
  background: var(--bg-alt);
  border-color: var(--accent);
}

.qc-tab.active {
  background: var(--accent);
  border-color: var(--accent);
}

.qc-tab.active .qc-tab__label,
.qc-tab.active .qc-tab__range {
  color: #fff;
}

.qc-tab__label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.qc-tab__range {
  font-size: 0.75rem;
  color: var(--muted);
}

.qc-section-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.qc-overview-card {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.qc-overview-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.qc-overview-card__title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.qc-overview-card__sub {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Detail view */
.qc-back-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  margin-bottom: 16px;
  display: inline-block;
}

.qc-back-btn:hover {
  text-decoration: underline;
}

.qc-detail-header {
  margin-bottom: 20px;
}

.qc-detail-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
}

.qc-detail-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.qc-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--muted);
}

.qc-badge.is-green {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.4);
  color: #16a34a;
}

.qc-badge.is-red {
  background: rgba(200, 50, 40, 0.1);
  border-color: rgba(200, 50, 40, 0.4);
  color: #c0302a;
}

/* Light cards in detail grid */
.qc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.qc-light-card {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  transition: border-color 0.2s;
}

.qc-light-card.is-offline {
  opacity: 0.5;
}

.qc-light-card.is-fault-flash {
  animation: fault-flash 1.4s ease-in-out infinite;
  border-color: rgba(200, 50, 40, 0.6);
}

.qc-light-card.is-setting {
  animation: setting-flash 0.5s ease-out forwards;
  border-color: rgba(80, 160, 255, 0.7);
  box-shadow: 0 0 10px rgba(80, 160, 255, 0.35);
}

.qc-light-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.qc-light-card__title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}

.qc-light-card__badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.qc-addr-status {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: monospace;
}

.qc-light-card__value {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  margin: 8px 0 10px;
  color: var(--ink);
}

.qc-light-card.is-setting .qc-light-card__value {
  color: rgba(80, 160, 255, 1);
}

.qc-light-card__slider {
  width: 100%;
  margin-bottom: 10px;
}

.qc-light-card__actions {
  display: flex;
  gap: 6px;
}

.qc-btn {
  flex: 1;
  padding: 7px 4px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.qc-btn:hover {
  border-color: var(--accent);
  background: var(--bg-alt);
}

.qc-btn--set {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.qc-btn--set:hover {
  opacity: 0.85;
}

.light-card__slider {
  width: 100%;
}

.light-card__actions {
  margin-top: 14px;
}

.light-card__actions button {
  flex: 1;
}

.light-card__actions button[data-action="off"] {
  background: rgba(33, 28, 20, 0.08);
}

.light-card__actions button[data-action="max"] {
  background: rgba(45, 122, 81, 0.14);
  color: var(--success);
}

.config-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.config-line {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
}

.config-label {
  min-width: 160px;
  font-weight: 600;
  color: var(--ink);
}

.config-value {
  color: var(--muted);
  font-size: 0.85rem;
}

.config-hint {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.steps-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.steps-list li strong {
  color: var(--ink);
}

.content-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.content-card h3 + .config-block {
  margin-top: 0;
}

.steps-list code {
  background: var(--line);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
}

body.is-fault {
  animation: faultFlash 1s ease-in-out infinite;
  transition: background-color 0.3s;
}

@keyframes faultFlash {
  0%, 100% { background-color: var(--bg); }
  50% { background-color: #3a0a0a; }
}

body.is-fault .site-shell {
  border-color: #ff4444;
}

.fault-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #cc0000;
  color: #fff;
  text-align: center;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  animation: faultFlashBanner 0.8s ease-in-out infinite;
  box-shadow: 0 2px 12px rgba(200, 0, 0, 0.4);
}

@keyframes faultFlashBanner {
  0%, 100% { background: #cc0000; }
  50% { background: #ff2222; }
}

.fault-banner__dismiss {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.fault-banner__dismiss:hover {
  background: rgba(255,255,255,0.35);
}

@media (max-width: 840px) {
  .site-header,
  .demo-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .hero__copy {
    padding: 28px;
  }

  .hero h1 {
    max-width: none;
  }
}

/* ─── Marketing page ─────────────────────────── */

.marketing-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  font-family: var(--font-body);
  color: var(--ink);
}

.mkt-section {
  margin-bottom: 72px;
}

/* Hero */
.mkt-section--hero {
  text-align: center;
  padding: 40px 0 56px;
}

.mkt-kicker {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.mkt-headline {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.18;
  color: var(--ink);
  margin: 0 0 24px;
}

.mkt-subline {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.65;
}

/* Stats */
.mkt-section--stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  text-align: center;
}

.mkt-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
}

.mkt-stat__number {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 6px;
}

.mkt-stat__label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.mkt-stat__note {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Two-col feature grid */
.mkt-section--two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.mkt-col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 28px 32px;
}

.mkt-icon-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.mkt-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.mkt-icon-label h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

.mkt-col p {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

/* How it works */
.mkt-section-title {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 40px;
  color: var(--ink);
}

.mkt-steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 680px;
  margin: 0 auto;
}

.mkt-step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.mkt-step__num {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mkt-step__body h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
}

.mkt-step__body p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.mkt-step__body p code {
  background: var(--line);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
}

/* CTA */
.mkt-section--cta {
  text-align: center;
  padding: 48px 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
}

.mkt-section--cta h2 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--ink);
}

.mkt-section--cta p {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0 0 32px;
}

.mkt-cta-buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.mkt-btn {
  display: inline-block;
  padding: 13px 28px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}

.mkt-btn:hover { opacity: 0.85; }

.mkt-btn--primary {
  background: var(--ink);
  color: var(--bg);
}

.mkt-btn--secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

/* ─── Document Generator form ────────────────── */

.doc-form__hint {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 16px;
}

.doc-upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.doc-upload-zone {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: 8px;
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--surface);
}

.doc-upload-zone:hover,
.doc-upload-zone.drag-over {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.doc-upload-zone.drag-over {
  border-style: solid;
}

.doc-upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.doc-upload-zone__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.doc-upload-zone__icon {
  font-size: 1.6rem;
  line-height: 1;
}

.doc-upload-zone__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.doc-upload-zone__hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.doc-upload-zone__files {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-form__section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.doc-form__section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.doc-form__section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.doc-form__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
}

.doc-form__status {
  font-size: 0.88rem;
}

.doc-form__section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Responsive */
@media (max-width: 640px) {
  .mkt-section--stats { grid-template-columns: 1fr; }
  .mkt-section--two-col { grid-template-columns: 1fr; }
  .mkt-headline { font-size: 1.9rem; }
}
