/* Keetsa Warranty Claim form — brand tokens per the Keetsa brand guide.
   Body copy uses the approved web fallback stack for Owners (Arial), matching
   the keetsa.com storefront body font. No black anywhere — Grey / Dark
   Lavender stand in for it. */

:root {
  --keetsa-moonlight: #FCF1E7;
  --keetsa-lavender: #6A6878;
  --keetsa-dark-lavender: #51515D;
  --keetsa-grey: #73737D;
  --keetsa-light-grey: #E9E9EC;
  --keetsa-white: #FFFFFF;
  --keetsa-lunar-tide-dark: #4F66B0; /* AA on white (5.44:1) — links & CTA */
  --keetsa-aurora: #5BC0B9;          /* accent fills only, never text */
  --keetsa-aurora-dark: #219B9A;     /* non-text UI accents (3.38:1) */

  --font-body: Arial, Helvetica, sans-serif;

  /* WCAG 1.4.11 requires 3:1 for the boundary of a UI component. The lighter
     border this replaced measured 1.63:1, so input edges were effectively
     invisible to low-vision users. Brand Grey is a solid 4.69:1 on white.
     Do not soften this back to an alpha value without re-measuring. */
  --field-border: var(--keetsa-grey);
  --focus-ring: 0 0 0 3px rgba(79, 102, 176, 0.22);
  --radius-field: 8px;
  --radius-panel: 10px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--keetsa-lavender);
  background: var(--keetsa-white);
}

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

[hidden] {
  display: none !important;
}

.claim {
  max-width: 640px;
  margin: 0 auto;
  padding: 44px 20px 64px;
}

@media (min-width: 750px) {
  .claim {
    padding: 56px 24px 88px;
  }
}

/* ── Banners ────────────────────────────────────────────── */

.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 32px;
}

.banner--success {
  background: rgba(91, 192, 185, 0.12);
  /* 3.15:1 against its own tint — clears WCAG 1.4.11 while keeping the
     Aurora colour. */
  border: 1.5px solid var(--keetsa-aurora-dark);
}

/* The error banner border is 2.08:1 even at full Sunset strength, and the
   brand palette has no darker warm colour (there is no red). It stays as a
   decorative edge rather than being forced to a neutral grey, because the
   banner is not an interactive component and nothing about identifying it
   depends on the border: it carries an icon, a bold "Your claim couldn't be
   submitted." heading, its own background tint, and it takes focus. WCAG
   1.4.11 covers boundaries *required* to identify a component or its state;
   this one is not. Recorded so it is not re-raised as an oversight. */
.banner--error {
  background: rgba(244, 180, 156, 0.16);
  border: 1.5px solid rgba(246, 146, 108, 0.55);
}

.banner__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--keetsa-aurora-dark);
}

.banner__text {
  flex: 1;
}

.banner__title {
  margin: 0 0 3px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--keetsa-dark-lavender);
}

.banner__copy {
  margin: 0;
  font-size: 13.5px;
}

.banner__list {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 13.5px;
}

.banner__list li + li {
  margin-top: 4px;
}

/* Lunar Tide darker measures 4.99:1 on the error banner's blended background
   (rgba(244,180,156,0.16) over white = #FDF3EF), so it clears AA for normal
   text. Underline is explicit so the link is never signalled by colour alone. */
.banner__list a {
  color: var(--keetsa-lunar-tide-dark);
  text-decoration: underline;
}

.banner:focus {
  outline: 2px solid var(--keetsa-lunar-tide-dark);
  outline-offset: 2px;
}

.banner__dismiss {
  flex-shrink: 0;
  display: inline-flex;
  padding: 4px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--keetsa-lavender);
  cursor: pointer;
}

.banner__dismiss svg {
  width: 15px;
  height: 15px;
}

/* ── Form layout ────────────────────────────────────────── */

.required-note {
  margin: 0 0 20px;
  font-size: 12.5px;
  color: var(--keetsa-grey);
}

.required-mark {
  color: var(--keetsa-grey);
  margin-left: 2px;
}

.fields {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px 16px;
}

@media (min-width: 750px) {
  .field-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 6px;
}

.label-row label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--keetsa-dark-lavender);
  line-height: 1.4;
}

.help-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  background: none;
  border: none;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--keetsa-lunar-tide-dark);
  text-decoration: underline;
  cursor: pointer;
}

.help-toggle svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* ── Inputs ─────────────────────────────────────────────── */

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  background: var(--keetsa-white);
  border: 1px solid var(--field-border);
  border-radius: var(--radius-field);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--keetsa-dark-lavender);
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  min-height: 108px;
  resize: vertical;
  line-height: 1.6;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236A6878' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

select:invalid {
  color: var(--keetsa-grey);
}

/* Error state. The boundary uses Dark Lavender (7.8:1 on white) because the
   Sunset accent only reaches 2.3:1 and would fail the 3:1 non-text contrast
   minimum; Sunset stays a decorative tint. Keyed on aria-invalid so the
   server-rendered no-JS path highlights too. Declared before the focus rules
   so focus styling wins while a field is focused. */
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--keetsa-dark-lavender);
  background-color: rgba(244, 180, 156, 0.14);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--keetsa-lunar-tide-dark);
  box-shadow: var(--focus-ring);
}

::placeholder {
  color: var(--keetsa-grey);
  opacity: 1;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.55;
  cursor: pointer;
}

/* ── Help panels ────────────────────────────────────────── */

.help-panel {
  background: var(--keetsa-moonlight);
  border-radius: var(--radius-panel);
  padding: 14px 16px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--keetsa-lavender);
}

.help-panel p {
  margin: 0 0 8px;
}

.help-panel p:last-child {
  margin-bottom: 0;
}

.help-panel ul {
  margin: 0;
  padding-left: 18px;
}

.help-panel li + li {
  margin-top: 6px;
}

.help-panel strong {
  color: var(--keetsa-dark-lavender);
}

@media (prefers-reduced-motion: no-preference) {
  .help-panel {
    animation: panel-in 0.18s ease-out;
  }

  @keyframes panel-in {
    from {
      opacity: 0;
      transform: translateY(-4px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ── Dropzone & file list ───────────────────────────────── */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 24px;
  background: var(--keetsa-white);
  /* 4.69:1 — the previous alpha dashed border measured 1.90:1, below the
     WCAG 1.4.11 3:1 minimum for a component boundary. */
  border: 1.5px dashed var(--keetsa-grey);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background-color 0.15s;
}

/* The file input is visually hidden, so its error state has to surface on the
   dropzone. Driven by a class (set by form.js, and server-side on the no-JS
   path) rather than :has() — the class is reliable across browsers and its
   lower specificity lets the :focus-within rule below win while focused. */
.dropzone--error {
  border-color: var(--keetsa-dark-lavender);
  background-color: rgba(244, 180, 156, 0.14);
}

.dropzone:focus-within,
.dropzone.is-dragging {
  border-color: var(--keetsa-lunar-tide-dark);
  box-shadow: var(--focus-ring);
}

.dropzone.is-dragging {
  background: var(--keetsa-moonlight);
}

.dropzone__icon {
  width: 28px;
  height: 28px;
  color: var(--keetsa-lunar-tide-dark);
}

.dropzone__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--keetsa-dark-lavender);
}

.dropzone__hint {
  font-size: 12px;
  color: var(--keetsa-grey);
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--keetsa-light-grey);
  border-radius: var(--radius-field);
  font-size: 13px;
  color: var(--keetsa-dark-lavender);
  word-break: break-word;
}

.file-list button {
  flex-shrink: 0;
  padding: 4px 10px;
  background: none;
  border: 1px solid var(--keetsa-grey);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--keetsa-dark-lavender);
  cursor: pointer;
}

.file-status {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--keetsa-grey);
}

.file-status:empty {
  margin: 0;
}

/* ── Submit area ────────────────────────────────────────── */

.submit-area {
  margin-top: 40px;
}

.g-recaptcha {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}

.dev-note {
  margin: 0 0 18px;
  padding: 10px 14px;
  background: var(--keetsa-light-grey);
  border-radius: var(--radius-field);
  font-size: 12.5px;
  color: var(--keetsa-dark-lavender);
}

.submit-row {
  display: flex;
  justify-content: center;
}

.submit-button {
  width: 100%;
  min-height: 48px;
  padding: 0 44px;
  /* Lavender with white text measures 5.43:1, and Dark Lavender on hover
     7.82:1 — both clear AA, and hovering increases contrast. */
  background: var(--keetsa-lavender);
  border: none;
  border-radius: var(--radius-field);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.015em;
  color: var(--keetsa-white);
  cursor: pointer;
  transition: background-color 0.18s;
}

@media (min-width: 750px) {
  .submit-button {
    width: auto;
    min-width: 200px;
  }
}

.submit-button:hover {
  background: var(--keetsa-dark-lavender);
}

.submit-button:disabled {
  opacity: 0.65;
  cursor: default;
}

.submit-status {
  min-height: 1.5em;
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--keetsa-dark-lavender);
}

.legal {
  margin: 14px 0 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.55;
  color: var(--keetsa-grey);
}

.legal a {
  color: var(--keetsa-lunar-tide-dark);
}

/* ── Focus visibility for non-field controls ────────────── */

.help-toggle:focus-visible,
.banner__dismiss:focus-visible,
.banner__list a:focus-visible,
.dev-note a:focus-visible,
.file-list button:focus-visible,
.submit-button:focus-visible,
.legal a:focus-visible,
.batch-dialog__close:focus-visible {
  outline: 2px solid var(--keetsa-lunar-tide-dark);
  outline-offset: 2px;
}

/* ── Batch number dialog ────────────────────────────────── */

.batch-dialog {
  width: min(880px, calc(100vw - 32px));
  padding: 0;
  border: none;
  border-radius: 16px;
  overflow: hidden;
  color: var(--keetsa-lavender);
  /* `top` is set from JS to sit beside the control that opened it; absolute
     positioning (rather than the modal default of fixed + margin:auto) is what
     lets that work. left/right with auto margins keep it horizontally centred.
     See the batch dialog handler in form.js for why centring is wrong here. */
  position: absolute;
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
}

.batch-dialog::backdrop {
  background: rgba(81, 81, 93, 0.45);
}

.batch-dialog__media {
  position: relative;
  background: var(--keetsa-moonlight);
}

.batch-dialog__media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  padding: 12px;
}

.batch-dialog__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(81, 81, 93, 0.65);
  border: none;
  border-radius: 50%;
  color: var(--keetsa-white);
  cursor: pointer;
}

.batch-dialog__close svg {
  width: 15px;
  height: 15px;
}

.batch-dialog__body {
  padding: 20px 22px 24px;
  font-family: var(--font-body);
}

.batch-dialog__title {
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--keetsa-dark-lavender);
}

.batch-dialog__body p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.65;
}

.batch-dialog__body p:last-child {
  margin-bottom: 0;
}

.batch-dialog__body strong {
  color: var(--keetsa-dark-lavender);
}
