/* UTM Generator — brand-aligned utility CSS.
   Replaces the upstream Tailwind build with a hand-written subset using
   Signicat brand tokens (loaded from /assets/signicat-brand.css). All class
   names match the original Tailwind names so the existing HTML & JS work
   unchanged. */

/* ── Base reset (Tailwind-style preflight, trimmed) ───────────────────── */
*, *::before, *::after { box-sizing: border-box; border: 0 solid #e5e7eb; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; }
body { margin: 0; line-height: 1.5; }
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; margin: 0; }
p, pre, hr, fieldset, blockquote { margin: 0; }
fieldset, legend { padding: 0; }
ol, ul, menu { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: inherit; }
button, input, optgroup, select, textarea {
  font-family: inherit; font-size: 100%; font-weight: inherit;
  line-height: inherit; color: inherit; margin: 0; padding: 0;
}
button, [role="button"] { cursor: pointer; }
button, select { text-transform: none; }
button, input:where([type=submit]), input:where([type=reset]), input:where([type=button]) {
  -webkit-appearance: button; background: transparent; background-image: none;
}
::placeholder { opacity: 1; color: #9ca3af; }
img, svg, video, canvas { display: block; max-width: 100%; }
[hidden]:where(:not([hidden=until-found])) { display: none; }
table { border-collapse: collapse; text-indent: 0; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.block { display: block; }
.flex { display: flex; }
.grid { display: grid; }
.hidden { display: none; }
.inline-flex { display: inline-flex; }

.fixed { position: fixed; }
.absolute { position: absolute; }
.relative { position: relative; }
.inset-0 { inset: 0; }
.right-4 { right: 1rem; }
.top-4 { top: 1rem; }
.z-50 { z-index: 50; }

.flex-1 { flex: 1 1 0%; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }
.text-left { text-align: left; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

/* Spacing */
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-2 { padding-inline: 0.5rem; }
.px-3 { padding-inline: 0.75rem; }
.px-4 { padding-inline: 1rem; }
.px-5 { padding-inline: 1.25rem; }
.px-6 { padding-inline: 1.5rem; }
.py-1 { padding-block: 0.25rem; }
.py-1\.5 { padding-block: 0.375rem; }
.py-2 { padding-block: 0.5rem; }
.py-3 { padding-block: 0.75rem; }
.py-4 { padding-block: 1rem; }
.py-6 { padding-block: 1.5rem; }
.py-8 { padding-block: 2rem; }
.pr-3 { padding-right: 0.75rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-6 { padding-top: 1.5rem; }

/* Sizing */
.w-5 { width: 1.25rem; }
.w-8 { width: 2rem; }
.w-12 { width: 3rem; }
.w-16 { width: 4rem; }
.w-full { width: 100%; }
.h-5 { height: 1.25rem; }
.h-8 { height: 2rem; }
.h-12 { height: 3rem; }
.h-16 { height: 4rem; }
.min-h-screen { min-height: 100vh; }
.max-w-4xl { max-width: 56rem; }
.max-w-xs { max-width: 20rem; }

/* Overflow / text */
.overflow-x-auto { overflow-x: auto; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.break-all { word-break: break-all; }
.uppercase { text-transform: uppercase; }

/* Typography */
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }
.font-mono { font-family: var(--sg-font-mono); }
.font-sans { font-family: var(--sg-font-brand); }

.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
@media (min-width: 768px) {
  .md\:text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
}

/* Cursors */
.cursor-pointer { cursor: pointer; }

/* Borders & radii */
.border { border-width: 1px; }
.border-4 { border-width: 4px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }
.border-transparent { border-color: transparent; }
.rounded-full { border-radius: 9999px; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-b-xl { border-bottom-right-radius: 0.75rem; border-bottom-left-radius: 0.75rem; }

/* Brand colors (mapped to Signicat tokens) */
.bg-white { background-color: var(--sg-white); }
.bg-white\/80 { background-color: rgba(255, 255, 255, 0.8); }
.bg-brand-purple { background-color: var(--sg-purple); }
.bg-brand-purple-light { background-color: var(--sg-purple-soft); }
.bg-brand-indigo { background-color: var(--sg-indigo); }
.bg-red-50 { background-color: #FFF5F5; }
.bg-amber-50 { background-color: #FFFBEB; }

.text-white { color: var(--sg-white); }
.text-brand-purple { color: var(--sg-purple); }
.text-brand-mint { color: var(--sg-mint-dark); }            /* Mint on white needs a darker shade for contrast */
.text-brand-indigo { color: var(--sg-indigo); }
.text-brand-graphite { color: var(--sg-graphite); }
.text-brand-graphite\/50 { color: rgba(43, 37, 58, 0.5); }
.text-brand-graphite\/60 { color: rgba(43, 37, 58, 0.6); }
.text-brand-graphite\/70 { color: rgba(43, 37, 58, 0.7); }
.text-amber-800 { color: #92400E; }
.text-red-500 { color: #EF4444; }
.text-red-600 { color: #DC2626; }
.text-red-800 { color: #991B1B; }

.border-brand-grey { border-color: var(--sg-grey); }
.border-brand-grey\/50 { border-color: rgba(234, 234, 234, 0.5); }
.border-brand-indigo { border-color: var(--sg-indigo); }
.border-brand-indigo\/20 { border-color: rgba(95, 54, 188, 0.2); }
.border-brand-indigo\/30 { border-color: rgba(95, 54, 188, 0.3); }
.border-brand-mint\/30 { border-color: rgba(65, 255, 209, 0.3); }
.border-red-300 { border-color: #FCA5A5; }
.border-amber-300 { border-color: #FCD34D; }
.border-t-brand-indigo { border-top-color: var(--sg-indigo); }
.border-t-brand-mint { border-top-color: var(--sg-mint); }

/* Shadows — Signicat-tinted */
.shadow-md { box-shadow: 0 4px 12px rgba(42, 0, 98, 0.08); }
.shadow-lg { box-shadow: 0 8px 24px rgba(42, 0, 98, 0.10); }
.shadow-xl { box-shadow: 0 1.5rem 5rem rgba(42, 0, 98, 0.14); }
.hover\:shadow-xl:hover { box-shadow: 0 1.5rem 5rem rgba(42, 0, 98, 0.18); }

/* Opacity helpers */
.opacity-25 { opacity: 0.25; }
.opacity-75 { opacity: 0.75; }

/* Transitions */
.transition-all {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 0.15s;
}
.transition-transform {
  transition-property: transform;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 0.15s;
}
.duration-200 { transition-duration: 0.2s; }
.ease-in-out { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }

/* Hover states */
.hover\:bg-brand-purple:hover { background-color: var(--sg-purple); }
.hover\:bg-brand-purple-light:hover { background-color: var(--sg-purple-soft); }
.hover\:bg-brand-indigo\/10:hover { background-color: rgba(95, 54, 188, 0.1); }
.hover\:bg-white\/50:hover { background-color: rgba(255, 255, 255, 0.5); }

/* Focus states (brand indigo ring) */
.focus\:outline-none:focus { outline: none; }
.focus\:ring-2:focus {
  box-shadow: 0 0 0 2px var(--sg-white), 0 0 0 4px var(--sg-indigo);
}
.focus\:ring-brand-indigo:focus { /* covered by ring-2 above */ }
.focus\:ring-offset-1:focus { /* covered by ring-2 above */ }
.focus\:ring-offset-2:focus { /* covered by ring-2 above */ }
.focus\:border-brand-indigo:focus { border-color: var(--sg-indigo); }

/* Spinner animation */
@keyframes spin { to { transform: rotate(1turn); } }
.animate-spin { animation: spin 1s linear infinite; }

/* Responsive grids */
@media (min-width: 640px) {
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
  .md\:p-8 { padding: 2rem; }
}

/* Page-specific helpers retained from original */
.custom-check input[type="checkbox"],
.custom-check input[type="radio"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--sg-grey);
  border-radius: 0.25rem;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  flex-shrink: 0;
  position: relative;
}
.custom-check input[type="radio"] { border-radius: 50%; }
.custom-check input[type="checkbox"]:checked,
.custom-check input[type="radio"]:checked {
  background: var(--sg-indigo);
  border-color: var(--sg-indigo);
}
.custom-check input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.custom-check input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}
.custom-check input:focus {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--sg-indigo);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}
.toast-in { animation: slideIn 0.3s ease-in-out forwards; }
.toast-out { animation: slideOut 0.3s ease-in-out forwards; }

.result-reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s ease-in-out;
}
.result-reveal.visible { opacity: 1; transform: translateY(0); }

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
}
.collapsible-content.open { max-height: 5000px; }

/* Signicat logo on dark backgrounds (inverse fill) */
.signicat-logo { display: inline-block; width: 8.5rem; line-height: 0; }
.signicat-logo svg { width: 100%; height: auto; display: block; }
.signicat-logo svg .st0 { fill: var(--sg-white); transition: fill 160ms ease; }
.signicat-logo svg .st1 { fill: var(--sg-purple); transition: fill 160ms ease; }
.signicat-logo:hover svg .st0 { fill: var(--sg-mint); }

/* Inputs — brand polish over Tailwind base */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--sg-purple);
}
input::placeholder,
textarea::placeholder { color: rgba(42, 0, 98, 0.45); }

/* Primary submit button gets the pill-on-hover treatment */
button[type="submit"].bg-brand-indigo {
  transition: background 160ms ease, border-radius 160ms ease, transform 160ms ease;
}
button[type="submit"].bg-brand-indigo:hover {
  background: var(--sg-purple);
  border-radius: 9999px;
  transform: translateY(-1px);
}
