/* ═════════════════════════════════════════════════════════════════════════
  CortePlaca.pt — Design System v3 (Canonical)
  Industrial identity: precise, functional, trustworthy.
  Green-led palette · 64px section rhythm · reduced radii.
  ═════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── PALETTE ──────────────────────────────────────────────────────────── */

  /* Primary: Industrial Green */
  --ds-green: #1D9E75;
  --ds-green-hover: #168763;
  --ds-green-deep: #0F6B4E;
  /* AA-safe interactive states for solid/outline green buttons.
     --ds-green itself is only 3.39:1 against white (fails WCAG AA 4.5:1
     for normal text) — kept as an accent/icon color, never as a
     text/background pair with white or near-black text. */
  --ds-green-deep-hover: #0C5A40;
  --ds-green-deep-active: #093F2D;
  --ds-green-soft: #E3F5EE;
  --ds-green-muted: #B5DECF;
  --ds-green-wash: #F0FAF5;
  --ds-green-text: #158560;

  /* Coral is reserved for destructive/error semantics only */
  --ds-coral: #B42318;
  --ds-coral-hover: #981B12;
  --ds-coral-soft: #FEE2E2;
  --ds-coral-text: #B42318;

  /* Neutrals: Ink to White */
  --ds-ink: #1F2937;
  --ds-ink-light: #374151;
  --ds-muted: #6B7280;
  --ds-subtle: #9CA3AF;
  --ds-border: #E5E7EB;
  --ds-surface: #F8F9FA;
  --ds-bg: #FFFFFF;

  /* Semantic */
  --ds-success: #047857;
  --ds-success-text: #047857;
  --ds-success-soft: #D1FAE5;
  --ds-warning: #B54708;
  --ds-warning-soft: #FEF3C7;
  --ds-error: #B42318;
  --ds-error-soft: #FEE2E2;
  --ds-info: #2563EB;
  --ds-info-soft: #DBEAFE;

  /* ── TYPOGRAPHY ───────────────────────────────────────────────────────── */

  /* Tipografia uniforme com a loja (re-skin premium): Barlow + Barlow Semi Condensed (títulos) + Source Code Pro (mono) */
  --ds-font: 'Barlow', system-ui, -apple-system, sans-serif;
  --ds-font-display: 'Barlow Semi Condensed', 'Barlow', system-ui, -apple-system, sans-serif;
  --ds-font-mono: 'Source Code Pro', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Scale (Major Third — 1.25 ratio, anchored at 15px body) */
  --ds-text-xs: 0.75rem;
  /* 12px — labels, captions */
  --ds-text-sm: 0.8125rem;
  /* 13px — small UI text */
  --ds-text-base: 1rem;
  /* 16px — body default */
  --ds-text-md: 1rem;
  /* 16px — body emphasis */
  --ds-text-lg: 1.125rem;
  /* 18px — lead, intro */
  --ds-text-xl: 1.25rem;
  /* 20px — h5 */
  --ds-text-2xl: 1.5rem;
  /* 24px — h4 */
  --ds-text-3xl: 1.875rem;
  /* 30px — h3 */
  --ds-text-4xl: 2.25rem;
  /* 36px — h2 */
  --ds-text-5xl: 3rem;
  /* 48px — h1 */

  /* Weights */
  --ds-weight-normal: 400;
  --ds-weight-medium: 500;
  --ds-weight-semibold: 600;
  --ds-weight-bold: 700;

  /* Line heights */
  --ds-leading-tight: 1.2;
  --ds-leading-normal: 1.5;
  --ds-leading-relaxed: 1.65;

  /* ── SPACING (4px base) ───────────────────────────────────────────────── */

  --ds-space-1: 0.25rem;
  /* 4px */
  --ds-space-2: 0.5rem;
  /* 8px */
  --ds-space-3: 0.75rem;
  /* 12px */
  --ds-space-4: 1rem;
  /* 16px */
  --ds-space-5: 1.25rem;
  /* 20px */
  --ds-space-6: 1.5rem;
  /* 24px */
  --ds-space-8: 2rem;
  /* 32px */
  --ds-space-10: 2.5rem;
  /* 40px */
  --ds-space-12: 3rem;
  /* 48px */
  --ds-space-16: 4rem;
  /* 64px */
  --ds-space-20: 5rem;
  /* 80px */

  /* ── BORDERS & RADIUS ─────────────────────────────────────────────────── */

  --ds-radius-xs: 4px;
  --ds-radius-sm: 6px;
  --ds-radius-md: 6px;
  --ds-radius-lg: 6px;
  --ds-radius-full: 9999px;

  /* ── SHADOWS ──────────────────────────────────────────────────────────── */

  --ds-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --ds-shadow-md: 0 6px 18px rgba(15, 23, 42, .1);
  --ds-shadow-lg: 0 14px 32px rgba(15, 23, 42, .12);

  /* ── TRANSITIONS ──────────────────────────────────────────────────────── */

  --ds-ease-fast: 150ms ease-out;
  --ds-ease-base: 200ms ease-out;
  --ds-ease-slow: 300ms ease-out;

  /* ── COMPAT ALIASES (bridge for legacy --cp-* vars) ───────────────────── */

  --cp-green: var(--ds-green);
  --cp-green-dark: var(--ds-green-hover);
  --cp-green-light: var(--ds-green-soft);
  --cp-green-mid: var(--ds-green);
  --cp-green-soft: var(--ds-green-soft);
  --cp-green-text: var(--ds-green-text);

  --cp-coral: var(--ds-error);
  --cp-coral-dark: var(--ds-error);
  --cp-coral-soft: var(--ds-coral-soft);
  --cp-coral-soft-2: var(--ds-bg);
  --cp-coral-border: var(--ds-border);
  --cp-coral-text: var(--ds-coral-text);

  --cp-text: var(--ds-ink);
  --cp-muted: var(--ds-muted);
  --cp-border: var(--ds-border);
  --cp-bg-light: var(--ds-surface);
  --cp-utility-bg: var(--ds-surface);
  --cp-surface: var(--ds-bg);
  --cp-surface-soft: var(--ds-surface);

  --cp-success: var(--ds-success);
  --cp-success-soft: var(--ds-success-soft);

  --cp-font: var(--ds-font);
  --cp-radius: var(--ds-radius-sm);
  --cp-shadow-sm: var(--ds-shadow-sm);
  --cp-shadow: var(--ds-shadow-md);

  --color-primary: var(--ds-green);
  --color-primary-hover: var(--ds-green-hover);
  --color-primary-soft: var(--ds-green-soft);
  --color-primary-500: var(--ds-green);
  --color-primary-600: var(--ds-green-hover);
  --color-neutral-50: var(--ds-surface);
  --color-accent: var(--ds-green);
  --color-accent-hover: var(--ds-green-hover);
  --color-accent-soft: var(--ds-green-soft);
  --color-bg: var(--ds-bg);
  --color-surface: var(--ds-bg);
  --color-surface-alt: var(--ds-surface);
  --color-border: var(--ds-border);
  --color-text-primary: var(--ds-ink);
  --color-text-secondary: var(--ds-muted);
  --color-text-tertiary: var(--ds-subtle);
  --color-error: var(--ds-error);
  --color-warning: var(--ds-warning);
  --color-success: var(--ds-success);
  --color-action: var(--ds-green);
}

/* ── BASE STYLES ───────────────────────────────────────────────────────── */

html {
  scroll-behavior: smooth;
}

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

body {
  font-family: var(--ds-font);
  font-size: var(--ds-text-base);
  line-height: var(--ds-leading-normal);
  color: var(--ds-ink);
  background: var(--ds-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--ds-font-display);
  font-weight: var(--ds-weight-bold);
  letter-spacing: -0.01em;
  line-height: var(--ds-leading-tight);
  color: var(--ds-ink);
  margin: 0;
}

h1 {
  font-size: var(--ds-text-5xl);
}

h2 {
  font-size: var(--ds-text-4xl);
}

h3 {
  font-size: var(--ds-text-3xl);
}

h4 {
  font-size: var(--ds-text-2xl);
}

h5 {
  font-size: var(--ds-text-xl);
}

h6 {
  font-size: var(--ds-text-md);
}

p {
  margin: 0 0 var(--ds-space-4);
}

/* ── GLOBAL RHYTHM ─────────────────────────────────────────────────────── */

:root {
  --cp-section-space-desktop: var(--ds-space-16);
  --cp-section-space-tablet: var(--ds-space-12);
  --cp-section-space-mobile: var(--ds-space-10);
  --cp-content-gap-desktop: var(--ds-space-6);
  --cp-content-gap-mobile: var(--ds-space-4);
}

main section,
.cp-section,
.ds-section {
  scroll-margin-top: calc(var(--ds-space-16) + var(--ds-space-4));
}

.cp-section,
.ds-section {
  padding-block: var(--cp-section-space-desktop);
}

.cp-stack,
.ds-stack {
  display: grid;
  gap: var(--cp-content-gap-desktop);
}

.card,
.ds-card,
.cp-card {
  border-radius: 12px;
}

.alert,
[role="alert"] {
  border-radius: 10px;
}

@media (max-width: 992px) {

  .cp-section,
  .ds-section {
    padding-block: var(--cp-section-space-tablet);
  }
}

@media (max-width: 640px) {

  .cp-section,
  .ds-section {
    padding-block: var(--cp-section-space-mobile);
  }

  .cp-stack,
  .ds-stack {
    gap: var(--cp-content-gap-mobile);
  }
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--ds-ease-fast);
}

a:hover {
  color: var(--ds-green);
}

img {
  max-width: 100%;
  height: auto;
}

/* ── SKIP LINK ─────────────────────────────────────────────────────────── */

.cp-skip-link {
  position: absolute;
  top: -48px;
  left: 12px;
  background: var(--ds-bg);
  color: var(--ds-ink);
  border: 2px solid var(--ds-green);
  border-radius: var(--ds-radius-xs);
  padding: var(--ds-space-2) var(--ds-space-3);
  z-index: 3000;
  font-size: var(--ds-text-sm);
  font-weight: var(--ds-weight-semibold);
}

.cp-skip-link:focus-visible {
  top: 8px;
}

/* ── BUTTONS ───────────────────────────────────────────────────────────── */

.btn,
.btn-cp,
.btn-cp-outline,
.btn-cp-coral {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ds-space-2);
  min-height: 44px;
  border-radius: var(--ds-radius-sm);
  box-shadow: none;
  background-image: none;
  font-weight: var(--ds-weight-semibold);
}

/* Bootstrap button normalization: flat, one-color (green) system
   NOTE: solid/outline pairs use --ds-green-deep* (not --ds-green) as the
   text/background partner — --ds-green itself only reaches 3.39:1 against
   white, which fails WCAG AA (4.5:1) for normal-weight button text. */
.btn,
.btn-primary,
.btn-success {
  background: var(--ds-green-deep);
  border-color: var(--ds-green-deep);
  color: #fff;
}

.btn:hover,
.btn-primary:hover,
.btn-success:hover {
  background: var(--ds-green-deep-hover);
  border-color: var(--ds-green-deep-hover);
  color: #fff;
}

.btn:active,
.btn-primary:active,
.btn-success:active {
  background: var(--ds-green-deep-active);
  border-color: var(--ds-green-deep-active);
  color: #fff;
}

.btn.alt,
.btn-outline-primary,
.btn-outline-success,
.btn-outline-secondary {
  background: #fff;
  border-color: var(--ds-green-deep);
  color: var(--ds-green-deep);
}

.btn.alt:hover,
.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-secondary:hover {
  background: var(--ds-green-deep);
  border-color: var(--ds-green-deep);
  color: #fff;
}

.btn.alt:active,
.btn-outline-primary:active,
.btn-outline-success:active,
.btn-outline-secondary:active {
  background: var(--ds-green-deep-hover);
  border-color: var(--ds-green-deep-hover);
  color: #fff;
}

/* Iconography utility for robust, consistent flat actions */
.cp-btn-icon .bi {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.cp-corte-svg,
.cp-corte-icon {
  width: 1.18em;
  height: 1.18em;
  display: inline-block;
  vertical-align: -0.08em;
  line-height: 1;
  object-fit: contain;
  flex-shrink: 0;
  color: currentColor;
}

.cp-btn-icon .cp-corte-svg,
.cp-btn-icon .cp-corte-icon {
  width: 1.18rem;
  height: 1.18rem;
  vertical-align: -0.06em;
}

/* Global responsive premium behavior for icon+label buttons */
.cp-btn-icon {
  white-space: normal;
  text-align: center;
  line-height: 1.2;
}

.cp-btn-label {
  display: inline;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.cp-btn-label--short {
  display: none;
}

.btn-cp {
  background: var(--ds-green-deep);
  color: #fff;
  border: none;
  font-family: var(--ds-font);
  font-size: 14px;
  padding: 10px 22px;
  cursor: pointer;
  transition: background var(--ds-ease-fast);
  text-decoration: none;
  line-height: 1;
}

.btn-cp:hover {
  background: var(--ds-green-deep-hover);
  color: #fff;
}

.btn-cp:active {
  background: var(--ds-green-deep-active);
}

.btn-cp-outline {
  background: transparent;
  color: var(--ds-green-deep);
  border: 1.5px solid var(--ds-green-deep);
  font-family: var(--ds-font);
  font-size: 14px;
  padding: 9px 22px;
  cursor: pointer;
  transition: all var(--ds-ease-fast);
  text-decoration: none;
  line-height: 1;
}

.btn-cp-outline:hover {
  background: var(--ds-green-deep);
  color: #fff;
}

.btn-cp-coral {
  background: var(--ds-coral);
  color: #fff;
  border: none;
  font-family: var(--ds-font);
  font-size: 14px;
  font-weight: var(--ds-weight-bold);
  padding: 10px 22px;
  cursor: pointer;
  transition: background var(--ds-ease-fast);
  text-decoration: none;
  line-height: 1;
}

.btn-cp-coral:hover {
  background: var(--ds-coral-hover);
  color: #fff;
}

/* Size variants */
.btn-sm {
  padding: 8px 16px;
  font-size: var(--ds-text-sm);
  min-height: 44px;
}

.btn-lg {
  padding: 14px 32px;
  font-size: var(--ds-text-md);
  min-height: 52px;
}

/* ── CARDS ─────────────────────────────────────────────────────────────── */

.ds-card {
  background: var(--ds-bg);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  padding: var(--ds-space-6);
  transition: border-color var(--ds-ease-fast), box-shadow var(--ds-ease-fast);
}

.ds-card:hover {
  border-color: var(--ds-green-muted);
  box-shadow: var(--ds-shadow-md);
}

/* ── FORMS ─────────────────────────────────────────────────────────────── */

.ds-label {
  display: block;
  font-size: 14px;
  font-weight: var(--ds-weight-medium);
  color: var(--ds-ink);
  margin-bottom: var(--ds-space-2);
}

.ds-input,
.ds-select {
  width: 100%;
  padding: var(--ds-space-3) var(--ds-space-4);
  border: 1.5px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  font-family: var(--ds-font);
  font-size: var(--ds-text-base);
  line-height: var(--ds-leading-normal);
  color: var(--ds-ink);
  background: var(--ds-bg);
  min-height: 44px;
  transition: border-color var(--ds-ease-fast), box-shadow var(--ds-ease-fast);
}

.ds-input:focus,
.ds-select:focus {
  outline: none;
  border-color: var(--ds-green);
  box-shadow: 0 0 0 3px var(--ds-green-soft);
}

.ds-input::placeholder {
  color: var(--ds-subtle);
}

textarea.ds-input {
  min-height: 120px;
  resize: vertical;
}

.ds-form-error {
  color: var(--ds-error);
  font-size: var(--ds-text-sm);
  margin-top: var(--ds-space-1);
  font-weight: var(--ds-weight-medium);
}

/* ── BADGES ────────────────────────────────────────────────────────────── */

.badge-express {
  background: var(--ds-green-soft);
  color: var(--ds-green-text);
  font-size: var(--ds-text-xs);
  font-weight: var(--ds-weight-semibold);
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid var(--ds-green-muted);
}

.badge-order {
  background: var(--ds-warning-soft);
  color: #92400E;
  font-size: var(--ds-text-xs);
  font-weight: var(--ds-weight-semibold);
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid #FDE68A;
}

.badge-quote {
  background: var(--ds-info-soft);
  color: #1E40AF;
  font-size: var(--ds-text-xs);
  font-weight: var(--ds-weight-semibold);
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid #BFDBFE;
}

/* ── ALERTS ────────────────────────────────────────────────────────────── */

.ds-alert {
  padding: var(--ds-space-4) var(--ds-space-6);
  border-radius: var(--ds-radius-sm);
  border-left: 4px solid;
  margin-bottom: var(--ds-space-4);
  font-size: 14px;
}

.ds-alert-success {
  background: var(--ds-success-soft);
  border-color: var(--ds-success);
  color: #065F46;
}

.ds-alert-error {
  background: var(--ds-error-soft);
  border-color: var(--ds-error);
  color: #991B1B;
}

.ds-alert-warning {
  background: var(--ds-warning-soft);
  border-color: var(--ds-warning);
  color: #92400E;
}

.ds-alert-info {
  background: var(--ds-info-soft);
  border-color: var(--ds-info);
  color: #1E40AF;
}

/* ── SECTION LABELS ────────────────────────────────────────────────────── */

.section-label {
  font-size: var(--ds-text-xs);
  font-weight: var(--ds-weight-bold);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--ds-green-text);
}

/* ── UTILITIES ─────────────────────────────────────────────────────────── */

.text-green {
  color: var(--ds-green-text);
}

.text-coral {
  color: var(--ds-coral-text);
}

.text-muted {
  color: var(--ds-muted);
}

.text-subtle {
  color: var(--ds-subtle);
}

.bg-surface {
  background: var(--ds-surface);
}

.bg-green-soft {
  background: var(--ds-green-soft);
}

/* ── REDUCED MOTION ────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 360px) {
  .cp-btn-label--full {
    display: none;
  }

  .cp-btn-label--short {
    display: inline;
  }
}