/* STS Request Intake Form v2 - Untitled UI form language, Hotrema brand */

:root {
  /* Surfaces */
  --surface-canvas: #fafafa;
  --surface-card: #ffffff;
  --surface-control: #ffffff;
  --surface-control-hover: #fafafa;
  --surface-selected: rgba(57, 82, 254, 0.06);
  --surface-success: #ecfdf3;

  /* Ink */
  --ink-primary: #181d27;
  --ink-secondary: #414651;
  --ink-tertiary: #535862;
  --ink-placeholder: #717680;
  --ink-on-brand: #ffffff;
  --ink-on-brand-muted: rgba(255, 255, 255, 0.72);
  --ink-success: #079455;
  --ink-error: #d92d20;

  /* Lines */
  --hairline: #e9eaeb;
  --hairline-control: #d5d7da;
  --hairline-error: #fda29b;

  /* Brand: navy surface from the logo, blue accent for interaction only */
  --brand: #13196d;
  --brand-hover: #1c2489;
  --accent: #3952fe;
  --focus-outline: 2px solid var(--accent);

  /* Depth: Untitled UI shadow-xs on controls, one soft lift on the card */
  --shadow-xs: 0 1px 2px rgba(10, 13, 18, 0.05);
  --shadow-card: 0 1px 2px rgba(10, 13, 18, 0.06), 0 4px 8px -2px rgba(10, 13, 18, 0.06);

  /* Shape */
  --radius-control: 8px;
  --radius-card: 16px;
  --radius-pill: 999px;

  /* Type */
  --font: 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-md: 16px;
  --text-lg: 18px;
  --display-xs: 24px;
  --display-sm: 30px;

  /* Spacing: 4px grid */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--ink-secondary);
  background: var(--surface-canvas);
  min-height: 100vh;
  padding: var(--sp-10) var(--sp-4);
}

.container {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

/* Card */
.card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* Header: brand band, with the wordmark H tucked into the bottom-right corner */
.header {
  position: relative;
  overflow: hidden;
  background: var(--brand);
  color: var(--ink-on-brand);
  padding: var(--sp-8) var(--sp-6);
}

.header > :not(.header-watermark) {
  position: relative;
  z-index: 1;
}

.header-watermark {
  position: absolute;
  right: -4%;
  bottom: -28%;
  height: 165%;
  color: #fff;
  opacity: 0.08;
  pointer-events: none;
}

.header-logo {
  height: 32px;
  width: auto;
  display: block;
  margin-bottom: var(--sp-5);
}

.header-title {
  font-size: var(--display-xs);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: var(--sp-1);
}

.header-subtitle {
  font-size: var(--text-md);
  color: var(--ink-on-brand-muted);
}

/* Form body */
form {
  padding: var(--sp-6);
}

.section + .section {
  margin-top: var(--sp-8);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--hairline);
}

.section-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--ink-primary);
}

.section-desc {
  font-size: var(--text-sm);
  color: var(--ink-tertiary);
  margin-top: 2px;
}

.section-fields {
  display: grid;
  gap: var(--sp-5);
  margin-top: var(--sp-5);
}

/* Field: label above, hint below */
.field[hidden] {
  display: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-secondary);
}

.label .req {
  color: var(--brand);
  margin-left: 2px;
}

.input,
.textarea {
  width: 100%;
  font: inherit;
  color: var(--ink-primary);
  background: var(--surface-control);
  border: 1px solid var(--hairline-control);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-xs);
  padding: 10px 14px;
  transition: border-color 100ms linear, box-shadow 100ms linear;
}

.input {
  height: 44px;
}

/* Select: native control, chevron drawn like Untitled UI's */
.select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-top: 0;
  padding-bottom: 0;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23717680' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.select:invalid { color: var(--ink-placeholder); }

.textarea {
  min-height: 128px;
  resize: vertical;
  line-height: 1.5;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-placeholder);
}

/* Untitled UI focus: the 1px ring thickens to a 2px brand ring, no outer glow */
.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), var(--shadow-xs);
}

.input.touched:invalid,
.textarea.touched:invalid {
  border-color: var(--hairline-error);
}

.error {
  display: none;
  font-size: var(--text-sm);
  color: var(--ink-error);
}

.touched:invalid ~ .error { display: block; }

.input.touched:invalid:focus,
.textarea.touched:invalid:focus {
  border-color: var(--ink-error);
  box-shadow: inset 0 0 0 1px var(--ink-error), var(--shadow-xs);
}

/* Hint with the examples toggle */
.hint {
  font-size: var(--text-sm);
  color: var(--ink-tertiary);
}

.hint-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-weight: 500;
  color: var(--ink-tertiary);
  background: none;
  border: 0;
  padding: 0;
  min-height: 24px;
  cursor: pointer;
  transition: color 150ms var(--ease-out);
}

.hint-toggle:hover { color: var(--ink-primary); }

.hint-toggle:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
  border-radius: 4px;
}

.hint-toggle svg {
  transition: transform 150ms var(--ease-out);
}

.hint-toggle[aria-expanded='true'] svg { transform: rotate(180deg); }
.hint-toggle[aria-expanded='false'] .when-open,
.hint-toggle[aria-expanded='true'] .when-closed { display: none; }

/* Expand/collapse: grid rows 0fr to 1fr animates height without JS */
.examples {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 200ms var(--ease-out), opacity 150ms var(--ease-out);
}

.examples > ul {
  min-height: 0;
  overflow: hidden;
  padding-left: var(--sp-5);
  list-style: disc;
}

.hint-toggle[aria-expanded='true'] + .examples {
  grid-template-rows: 1fr;
  opacity: 1;
}

.hint-toggle[aria-expanded='true'] + .examples > ul { padding-top: var(--sp-2); }

.examples li { margin-bottom: var(--sp-1); }
.examples li::marker { color: var(--hairline-control); }

/* Urgency: card radio group */
fieldset { border: 0; min-width: 0; }
legend { padding: 0; }

.radio-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
}

.radio-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-4);
  background: var(--surface-control);
  border: 1px solid var(--hairline-control);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: border-color 150ms var(--ease-out), background-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}

.radio-card:hover { background: var(--surface-control-hover); }

.radio-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Untitled UI icons: Clock, Calendar, AlertTriangle. Tertiary at rest, accent when selected */
.radio-card-icon {
  display: flex;
  color: var(--ink-tertiary);
  margin-bottom: var(--sp-2);
  transition: color 150ms var(--ease-out);
}

.radio-card:has(input:checked) .radio-card-icon { color: var(--accent); }

.radio-card-title {
  padding-right: var(--sp-6);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-primary);
}

.radio-card-desc {
  font-size: var(--text-sm);
  color: var(--ink-tertiary);
}

/* The radio dot, drawn like Untitled UI's: 16px ring, brand fill with white dot when checked */
.radio-dot {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  width: 16px;
  height: 16px;
  border: 1px solid var(--hairline-control);
  border-radius: 50%;
  background: var(--surface-control);
  transition: border-color 150ms var(--ease-out), background-color 150ms var(--ease-out);
}

.radio-dot::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0;
  transition: opacity 150ms var(--ease-out);
}

.radio-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--surface-selected);
}

.radio-card:has(input:checked) .radio-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.radio-card:has(input:checked) .radio-dot::after { opacity: 1; }

.radio-card:has(input:focus-visible) {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* Primary button */
.button-primary {
  width: 100%;
  height: 44px;
  margin-top: var(--sp-8);
  font: inherit;
  font-weight: 600;
  color: var(--ink-on-brand);
  background: var(--brand);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  position: relative;
  transition: background-color 150ms var(--ease-out), transform 100ms var(--ease-out), box-shadow 150ms var(--ease-out);
}

.button-primary:hover { background: var(--brand-hover); }
.button-primary:active { transform: scale(0.98); }

.button-primary:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

.button-primary:disabled {
  background: var(--hairline-control);
  cursor: not-allowed;
  transform: none;
}

.button-primary.loading { color: transparent; }

.button-primary.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Thank you */
.thanks {
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
}

.thanks-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--sp-5);
  border-radius: 50%;
  background: var(--surface-success);
  box-shadow: 0 0 0 8px #dcfae6;
  color: var(--ink-success);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.thanks-icon svg { width: 28px; height: 28px; }

/* Once on load: circle settles in, the check draws itself, one ring ripples out */
.thanks-icon {
  animation: settle 400ms var(--ease-out) both;
}

.thanks-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--ink-success);
  opacity: 0;
  animation: ripple 700ms var(--ease-out) 350ms both;
}

.thanks-check {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: draw 350ms var(--ease-out) 250ms forwards;
}

@keyframes settle {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

@keyframes ripple {
  from { opacity: 0.4; transform: scale(1); }
  to { opacity: 0; transform: scale(1.6); }
}

.thanks-title {
  font-size: var(--display-xs);
  font-weight: 600;
  color: var(--ink-primary);
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin-bottom: var(--sp-2);
}

.thanks-text {
  font-size: var(--text-md);
  color: var(--ink-tertiary);
  text-wrap: pretty;
}

.thanks-sla {
  display: inline-block;
  margin-top: var(--sp-6);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  background: var(--surface-canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
}

/* Untitled UI secondary button: white, gray ring, shadow-xs */
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  margin-top: var(--sp-8);
  padding: 0 var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-secondary);
  background: var(--surface-control);
  border: 1px solid var(--hairline-control);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}

.button-secondary:hover {
  color: var(--ink-primary);
  background: var(--surface-control-hover);
  text-decoration: none;
}

.button-secondary:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* Responsive */
@media (max-width: 600px) {
  body { padding: var(--sp-4); }
  .header, form { padding: var(--sp-6) var(--sp-5); }
  .radio-cards { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
  .thanks-check { stroke-dashoffset: 0; }
}
