/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Add your application-specific styles here */

html {
  /* The one anchor offset: the 73px sticky header plus a little air.
     Pages with extra sticky bars add only that bar's height as scroll-margin-top. */
  scroll-padding-top: 88px;
}

:root {
  color-scheme: light;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #f7f7f2;
}

/* Primary and secondary buttons (used across pages) */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.35rem;
  background: #244ee8;
  color: white;
  font-weight: 650;
  border-radius: 6px;
  border: 1px solid #244ee8;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
  text-decoration: none;
}

.btn-primary:hover {
  background: #173bc4;
  border-color: #173bc4;
}

.btn-secondary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.35rem;
  background: transparent;
  color: #162824;
  font-weight: 650;
  border-radius: 6px;
  border: 1px solid #b5c0b7;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}

.btn-secondary:hover {
  background: #ffffff;
  border-color: #162824;
}

/* Customer logos: no tile and no hover lift */
.customer-mark {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  padding: 0.35rem;
  opacity: 1;
  filter: none;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.customer-mark:hover,
.customer-mark:focus-visible {
  opacity: 1;
  filter: grayscale(0);
}

.customer-mark img {
  width: 100%;
  height: 6rem;
  max-width: 12rem;
  max-height: none;
  object-fit: contain;
}

@media (max-width: 640px) {
  .customer-mark img {
    height: 5rem;
  }
}

/* Accessibility: Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.focus\:not-sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .btn-primary {
    border: 2px solid currentColor !important;
  }
}

/* Loading spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Enhanced button loading state */
.btn-primary.is-loading,
.btn-secondary.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
}

.btn-primary.is-loading::after,
.btn-secondary.is-loading::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Rails wraps invalid fields in .field_with_errors on server-side validation
   failures; keep the wrapper from breaking grid/flex layouts and mark the
   field visibly invalid. */
.field_with_errors {
  display: contents;
}

.field_with_errors input,
.field_with_errors textarea {
  border-color: #ef4444;
}

/* Character counter */
.char-counter {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: right;
  margin-top: 0.5rem;
  transition: color 0.2s;
}

.char-counter.near-limit {
  color: #f97316;
  font-weight: 600;
}

.char-counter.at-limit {
  color: #ef4444;
  font-weight: 600;
}

/* Text selection in the site's blue, readable on paper and ink */
::selection {
  background-color: #244ee833;
  color: inherit;
}

/* Range sliders (the narrator volume on /model) */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: #dce1d9;
  border-radius: 9999px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #162824;
  cursor: pointer;
  border: 3px solid #fff;
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #162824;
  cursor: pointer;
  border: 3px solid #fff;
}

input[type="range"]::-moz-range-track {
  height: 8px;
  background: #dce1d9;
  border-radius: 9999px;
}
