/* Brand palette matches maprog.cl (see f:/maprog/public/css/style.css :root) so this
   tool feels visually consistent with the rest of the MAPROG site it's hosted under. */
:root {
  --color-bg: #F7F8FA;
  --color-surface: #FFFFFF;
  --color-border: #E1E4EA;
  --color-text: #191D24;
  --color-text-muted: #5B6270;
  --color-primary: #0B0E14;
  --color-primary-hover: #171B24;
  --color-accent: #2955D9;
  --color-accent-dark: #1F3FA8;
  --color-accent-soft: #EAEFFC;
  --color-error-bg: #fdecea;
  --color-error-border: #e0503a;
  --color-error-text: #8a2c1b;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 4px;
  --max-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Header */
.site-header {
  background: var(--color-primary);
  color: #fff;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.site-logo {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-logo__mark {
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 2px;
  position: relative;
  display: inline-block;
}

.site-logo__mark::before,
.site-logo__mark::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
}

.site-logo__mark::before { left: 2px; }
.site-logo__mark::after { right: 2px; }

.site-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.site-nav a {
  color: #dfe3e8;
  text-decoration: none;
  font-size: 0.92rem;
}

.site-nav a:hover {
  color: #fff;
}

.site-nav__lang {
  border: 1px solid #55606c;
  border-radius: 3px;
  padding: 2px 8px;
  font-weight: 700;
  font-size: 0.78rem !important;
  letter-spacing: 0.04em;
}

.site-nav__lang:hover {
  border-color: #fff;
}

/* Hero */
.hero {
  padding: 36px 20px 8px;
  text-align: left;
}

.hero h1 {
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}

.hero__lede {
  color: var(--color-text-muted);
  max-width: 720px;
  font-size: 1.02rem;
  margin: 0;
}

/* Generator layout */
.generator {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 24px 20px 48px;
}

@media (min-width: 960px) {
  .generator {
    grid-template-columns: 420px 1fr;
    align-items: start;
  }
}

.field-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px 6px;
  margin: 0 0 16px;
  background: var(--color-surface);
}

.field-group legend {
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  padding: 0 6px;
}

.field {
  margin-bottom: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.field__hint {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--color-text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

textarea {
  resize: vertical;
  min-height: 56px;
  font-family: inherit;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.checkbox-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.checkbox-field label {
  margin: 0;
  font-weight: 600;
  font-size: 0.85rem;
}

/* Wizard steps */
.wizard-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
}

.wizard-steps button {
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wizard-steps button .step-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-border);
  color: #fff;
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wizard-steps button.is-active {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.wizard-steps button.is-active .step-num {
  background: var(--color-primary);
}

.wizard-step {
  display: none;
}

.wizard-step.is-active {
  display: block;
}

.wizard-step__intro {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0 0 14px;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0;
}

/* Bolt info card (generator, Holes step) */
.bolt-info {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-accent-soft, var(--color-bg));
  padding: 4px 14px 14px;
  margin: 0 0 16px;
}

.bolt-info .tool-result-table th,
.bolt-info .tool-result-table td {
  padding: 6px 8px;
}

/* Logo upload */
.logo-upload {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--color-surface);
}

.logo-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.logo-preview__thumb {
  width: 64px;
  height: 64px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50% / 12px 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-preview__thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.logo-preview__meta {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  flex: 1;
}

.logo-preview__actions {
  display: flex;
  gap: 8px;
}

.logo-preview__actions button {
  font-size: 0.78rem;
  padding: 6px 10px;
}

.print-warning {
  background: #fff7ed;
  border: 1px solid #f3b98a;
  color: #7a3d0a;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.85rem;
  margin: 0 0 14px;
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.btn {
  border: none;
  border-radius: var(--radius);
  padding: 11px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
}

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

.btn--primary:hover {
  background: var(--color-primary-hover);
}

.btn--secondary {
  background: #fff;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn--secondary:hover {
  background: #eef0f2;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-errors {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  color: var(--color-error-text);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.9rem;
  margin: 14px 0;
}

/* Preview */
.preview {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 420px;
  position: sticky;
  top: 16px;
}

.preview__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}

.scale-badge {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  background: var(--color-primary);
  color: #fff;
  padding: 4px 9px;
  border-radius: 3px;
}

.zoom-controls {
  display: flex;
  gap: 6px;
}

.zoom-controls button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1rem;
}

.zoom-controls #zoomResetBtn {
  width: auto;
  padding: 0 10px;
  font-size: 0.78rem;
}

.preview__viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  cursor: grab;
  min-height: 360px;
  touch-action: none;
}

.preview__viewport.is-panning {
  cursor: grabbing;
}

.preview__empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

.preview__stage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
}

.preview__stage svg {
  display: block;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
  background: #fff;
}

.preview__note {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  padding: 8px 14px;
  margin: 0;
  border-top: 1px solid var(--color-border);
}

/* How it works / Features / FAQ */
.how-it-works,
.features,
.faq {
  padding: 32px 20px;
}

.how-it-works {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  counter-reset: steps;
  list-style: none;
  padding: 0;
  max-width: 900px;
}

.steps li {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 14px;
  font-weight: 600;
  position: relative;
  padding-top: 34px;
}

.steps li::before {
  counter-increment: steps;
  content: counter(steps);
  position: absolute;
  top: 10px;
  left: 14px;
  font-size: 0.8rem;
  color: #fff;
  background: var(--color-primary);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.feature-grid h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.feature-grid p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

.faq-list {
  max-width: 780px;
}

.faq-item {
  border-bottom: 1px solid var(--color-border);
  padding: 12px 0;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
}

.faq-item p {
  color: var(--color-text-muted);
  margin: 10px 0 0;
}

/* Static pages */
.static-page {
  padding: 36px 20px 60px;
  max-width: 780px;
}

.static-page h1 {
  margin-top: 0;
}

.placeholder-note {
  color: var(--color-accent);
  font-size: 0.85rem;
}

.not-found ul {
  padding-left: 20px;
}

/* Footer */
.site-footer {
  background: #eceef1;
  border-top: 1px solid var(--color-border);
  padding: 22px 20px 40px;
  margin-top: 20px;
}

.site-footer__inner {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.site-footer__madeby {
  margin-top: 6px;
}

.site-footer__madeby a {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
}

.site-footer__madeby a:hover {
  text-decoration: underline;
}

.site-footer__nav {
  margin-top: 10px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.site-footer__nav a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.site-footer__nav a:hover {
  color: var(--color-primary);
}

/* Workshop tools */
.tools-page,
.tool-page {
  padding: 36px 20px 60px;
  max-width: 780px;
}

.tools-hub__intro,
.tool-intro {
  color: var(--color-text-muted);
  max-width: 640px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.tool-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tool-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm, 0 1px 4px rgba(0, 0, 0, 0.08));
}

.tool-card h2 {
  font-size: 1rem;
  margin: 0 0 4px;
}

.tool-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

.tool-breadcrumb {
  margin: 0 0 12px;
}

.tool-breadcrumb a {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 0.88rem;
}

.tool-breadcrumb a:hover {
  text-decoration: underline;
}

.tool-widget {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 18px 0;
}

.tool-widget h2 {
  margin-top: 0;
}

.tool-result-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.92rem;
}

.tool-result-table th,
.tool-result-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
}

.tool-result-table th {
  color: var(--color-text-muted);
  font-weight: 600;
  width: 45%;
}

.tool-result-table tr.tool-result-highlight th,
.tool-result-table tr.tool-result-highlight td {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-primary);
}

.tool-full-table {
  margin-bottom: 24px;
}

.tool-full-table a {
  color: var(--color-accent);
  text-decoration: none;
}

.tool-full-table a:hover {
  text-decoration: underline;
}

.tool-coords-table th,
.tool-coords-table td {
  text-align: center;
}

.tools-disclaimer {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
  margin-top: 24px;
}
