:root {
  --bg: #050816;
  --bg-alt: #0d1020;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.12);
  --accent-strong: rgba(79, 70, 229, 0.2);
  --accent-text: #e0e7ff;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --border-subtle: #1f2933;
  --danger: #f97373;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.55);
  --max-width: 1120px;
  --transition-fast: 150ms ease-out;
  --checker-light: #f3f4f6;
  --checker-dark: #e5e7eb;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: radial-gradient(circle at top left, #1f2937, #020617 55%);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

/* Layout helpers */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: linear-gradient(to bottom, rgba(2, 6, 23, 0.9), rgba(2, 6, 23, 0.7));
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
}

.site-logo {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
  font-size: 0.95rem;
}

.site-logo span {
  color: var(--accent);
}

.tagline {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.25rem 0;
  position: relative;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.2rem;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition-fast);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text-main);
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after {
  width: 100%;
}

/* Hero */

.hero {
  padding: 3.5rem 0 2rem;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr);
  gap: 2.5rem;
  align-items: center;
}

.hero-copy h1 {
  font-size: clamp(1.9rem, 3vw, 2.4rem);
  margin: 0 0 0.75rem;
}

.hero-copy p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.hero-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  display: grid;
  gap: 0.15rem;
  font-size: 0.95rem;
  color: var(--accent-text);
}

.hero-panel {
  display: flex;
  justify-content: flex-end;
}

.hero-preview-card {
  background: radial-gradient(circle at top left, var(--accent-strong), var(--bg-alt));
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.35);
  overflow: hidden;
  max-width: 360px;
  width: 100%;
}

.hero-preview-header {
  padding: 0.9rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  background: linear-gradient(to right, rgba(15, 23, 42, 0.9), rgba(30, 64, 175, 0.7));
}

.hero-preview-body {
  padding: 1rem 1.1rem 1.1rem;
  font-size: 0.9rem;
  color: var(--accent-text);
}

.hero-preview-footnote {
  font-size: 0.78rem;
  color: rgba(226, 232, 240, 0.8);
}

/* Buttons */

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    color var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #eef2ff;
  box-shadow: 0 12px 25px rgba(79, 70, 229, 0.45);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 16px 35px rgba(79, 70, 229, 0.6);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.6);
  color: var(--text-muted);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  border-color: rgba(148, 163, 184, 1);
  color: var(--text-main);
}

/* Tool section */

.tool-section {
  padding: 2rem 0 2.5rem;
}

.tool-section h2 {
  font-size: 1.6rem;
  margin-bottom: 0.3rem;
}

.section-intro {
  margin: 0.15rem 0 1.5rem;
  color: var(--text-muted);
  max-width: 48rem;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.75fr);
  gap: 1.75rem;
  align-items: flex-start;
}

.tool-controls {
  background: rgba(15, 23, 42, 0.9);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.45);
  padding: 1.2rem 1.2rem 1.1rem;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tool-block h3 {
  font-size: 1rem;
  margin: 0 0 0.3rem;
}

.hint {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.hint.small {
  font-size: 0.8rem;
  margin-top: 0.4rem;
}

/* File input */

.file-input-label {
  margin-top: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px dashed rgba(148, 163, 184, 0.6);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-main);
}

.file-input-label input[type="file"] {
  display: none;
}

.file-name {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

#fileInfo {
  margin-top: 0.2rem;
}

/* Colour picker row */

.color-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.6rem;
}

.color-row label {
  font-size: 0.9rem;
  flex-shrink: 0;
}

#colorPicker {
  width: 44px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.color-preview {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.7);
  background: #000000;
}

/* Tool actions */

.tool-actions {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* Preview side */

.tool-canvas {
  background: rgba(15, 23, 42, 0.8);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.5);
  padding: 1.1rem 1.15rem 1rem;
  box-shadow: var(--shadow-soft);
}

.tool-canvas h3 {
  margin: 0 0 0.35rem;
}

/* Preview layout */

.preview-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.preview-card {
  background: rgba(15, 23, 42, 0.95);
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.5);
  padding: 0.55rem 0.7rem;
}

.preview-card h4 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
}

.preview-inner {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 1));
}

.preview-bg {
  position: relative;
  padding: 0.75rem;
  background-image:
    linear-gradient(45deg, var(--checker-light) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-light) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-light) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-light) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
}

#originalImg {
  max-width: 100%;
  max-height: 120px;
  display: none;
}

#originalSvgHolder svg {
  max-width: 100%;
  max-height: 120px;
}

#rasterCanvas {
  max-width: 100%;
  max-height: 120px;
  display: none;
}

#svgOutput svg {
  max-width: 100%;
  max-height: 120px;
}

/* Status message */

.status-message {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-message.error {
  color: var(--danger);
}

/* Info sections */

.info-section {
  padding: 2.25rem 0;
  border-top: 1px solid rgba(15, 23, 42, 0.9);
}

.info-section h2 {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
}

.info-section p {
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.steps-list {
  margin: 0.5rem 0 1rem;
  padding-left: 1.1rem;
  color: var(--text-muted);
}

.steps-list code {
  font-size: 0.85em;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.2rem;
  margin-top: 0.5rem;
}

.faq-item {
  background: rgba(15, 23, 42, 0.9);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.faq-item h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

/* Footer */

.site-footer {
  border-top: 1px solid rgba(15, 23, 42, 1);
  padding: 1.1rem 0 1.4rem;
  background: radial-gradient(circle at bottom, #020617, #020617 60%);
}

.footer-inner {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footnote {
  margin-top: 0.35rem;
}

.footnote a {
  color: var(--accent-text);
  text-decoration: none;
}

.footnote a:hover,
.footnote a:focus-visible {
  text-decoration: underline;
}

/* Responsive */

@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-panel {
    justify-content: flex-start;
  }

  .tool-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .site-nav {
    display: none;
  }
}

@media (max-width: 640px) {
  .tool-controls,
  .tool-canvas {
    padding: 0.95rem 0.95rem 0.9rem;
  }

  .hero {
    padding-top: 2.4rem;
  }

  .preview-bg {
    min-height: 120px;
  }
}
