/* ============================================================
   Linn Feedback — "Paper" minimal white UI
   ============================================================ */

:root {
  color-scheme: light;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --bg: #fafafa;
  --surface: #ffffff;

  --ink: #14161a;
  --ink-secondary: #3f4550;
  --muted: #79808f;
  --faint: #a7aebc;

  --line: #e8eaef;
  --line-strong: #d7dbe3;

  --accent: #2457a6;
  --accent-dark: #1a4384;
  --accent-soft: #f0f5fd;
  --accent-ring: rgba(36, 87, 166, .18);

  --gold: #f5b301;
  --success: #16a34a;
  --success-soft: #edfaf2;
  --danger: #dc2626;
  --danger-soft: #fdf2f2;

  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-card: 0 1px 2px rgba(16, 24, 40, .05), 0 16px 40px -20px rgba(16, 24, 40, .14);
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(rgba(20, 22, 26, .05) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea { font: inherit; color: inherit; }

h1,
p { margin: 0; }

::selection { background: rgba(36, 87, 166, .16); }

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Shell ---------- */

.page-shell {
  width: min(640px, calc(100% - 20px));
  margin: 22px auto 0;
}

.page-shell--center {
  flex: 1;
  display: flex;
  align-items: center;
  margin-top: 0;
}

.page-shell--center .card { width: 100%; }

.site-footer {
  padding: 18px 16px 28px;
  color: var(--faint);
  font-size: 12.5px;
  text-align: center;
}

/* ---------- Card ---------- */

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  animation: card-in .5s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Hero ---------- */

.hero {
  padding: 24px 28px 22px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.hero__logo,
.state__logo {
  display: block;
  width: 156px;
  height: 66px;
  margin: 0 auto 16px;
  object-fit: contain;
  object-position: center;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero__eyebrow::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.hero__title {
  margin-top: 10px;
  font-size: clamp(23px, 4.4vw, 29px);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -.022em;
}

.hero__intro {
  max-width: 52ch;
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}

/* ---------- Progress ---------- */

.progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px 0;
}

.progress[hidden] { display: none; }

.progress__track {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: #eef0f4;
  overflow: hidden;
}

.progress__bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .35s cubic-bezier(.3, .8, .3, 1);
}

.progress__caption {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Alert ---------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 28px 0;
  padding: 12px 14px;
  border: 1px solid #f3caca;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.5;
}

.alert svg { flex: 0 0 auto; margin-top: 1px; }

/* ---------- Form & questions ---------- */

.form { padding: 2px 28px 28px; }

.question {
  min-width: 0;
  margin: 0;
  padding: 24px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.question:first-of-type { padding-top: 22px; }
.question:last-of-type { border-bottom: 0; padding-bottom: 6px; }

.question__heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  margin-bottom: 12px;
}

.question__index {
  flex: 0 0 auto;
  color: #c2c8d3;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}

.question__text {
  font-size: 15.5px;
  font-weight: 650;
  line-height: 1.5;
}

.question__flag {
  flex: 0 0 auto;
  margin-left: -9px;
  font-size: 12px;
  font-weight: 600;
}

.question__flag--required { color: var(--accent); font-weight: 800; }
.question__flag--optional {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6f7f9;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.2;
}

.question__help {
  margin: -6px 0 10px;
  color: var(--faint);
  font-size: 13px;
}

/* ---------- Text controls ---------- */

.control {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  outline: none;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  transition: border-color .16s ease, box-shadow .16s ease;
}

textarea.control { resize: vertical; min-height: 84px; line-height: 1.6; }

.control:hover:not(:disabled) { border-color: #b9c0cd; }

.control:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20, 22, 26, .07);
}

.control::placeholder { color: var(--faint); }

select.control {
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2379808f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
}

/* ---------- Choice list (checkbox / radio rows) ---------- */

.option-grid {
  display: grid;
  gap: 10px;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.option:hover { border-color: var(--ink); }

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

.option__control {
  display: grid;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  color: transparent;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.option input[type="radio"] + .option__control { border-radius: 50%; }

.option input[type="radio"] + .option__control::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.option input[type="checkbox"] + .option__control { border-radius: 6px; }

.option:hover .option__control { border-color: var(--accent); }

.option input:checked ~ .option__control {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option input:checked ~ .option__label { color: var(--accent-dark); font-weight: 650; }

.option input:focus-visible ~ .option__control {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.option__label { font-size: 15px; font-weight: 500; line-height: 1.4; }

/* ---------- Yes / No ---------- */

.boolean {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.boolean__option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 11px 26px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}

.boolean__option:hover { border-color: var(--ink); }

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

.boolean__icon { display: grid; place-items: center; color: var(--muted); transition: color .15s ease; }

.boolean__text { font-size: 15px; font-weight: 650; color: var(--ink-secondary); }

.boolean__option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 6px 14px -8px rgba(36, 87, 166, .6);
}

.boolean__option:has(input:checked) .boolean__icon,
.boolean__option:has(input:checked) .boolean__text { color: #fff; }

.boolean__option input:focus-visible ~ .boolean__icon {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Rating: stars ---------- */

.rating__stars {
  position: relative;
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 4px;
}

.rating__input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.rating__star {
  cursor: pointer;
  color: #d9dee8;
  font-size: 37px;
  line-height: 1;
  transition: color .15s ease, transform .15s ease;
}

.rating__star:hover { transform: scale(1.1); }

.rating__star:hover,
.rating__stars:hover .rating__star:hover ~ .rating__star,
.rating__input:checked ~ .rating__star { color: var(--gold); }

.rating__input:focus-visible + .rating__star {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.rating__status {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  min-height: 1.4em;
}

/* ---------- Rating: numeric scale ---------- */

.scale__options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scale__item { position: relative; }

.scale__input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.scale__pill {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 14.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.scale__item:hover .scale__pill { border-color: var(--ink); }

.scale__input:checked + .scale__pill {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.scale__input:focus-visible + .scale__pill {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.scale__captions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Submit ---------- */

.submit {
  position: relative;
  display: block;
  width: 100%;
  min-height: 50px;
  margin-top: 20px;
  padding: 13px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 10px 22px -10px rgba(36, 87, 166, .55);
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: .01em;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.submit:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 14px 26px -10px rgba(36, 87, 166, .55);
}

.submit:active:not(:disabled) { transform: translateY(0); }

.submit:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.submit:disabled { cursor: default; opacity: .85; }

.submit__label { display: inline-block; transition: opacity .15s ease; }

.submit.is-loading .submit__label { opacity: 0; }

.submit__spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 21px;
  height: 21px;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.submit.is-loading .submit__spinner { opacity: 1; animation: spin .7s linear infinite; }

@keyframes spin { to { transform: rotate(1turn); } }

/* ---------- State cards ---------- */

.state {
  padding: 38px 28px 34px;
  text-align: center;
}

.state__logo { margin-bottom: 20px; }

.state__badge {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  animation: pop-in .4s cubic-bezier(.2, 1.4, .4, 1) both;
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(.6); }
  to { opacity: 1; transform: scale(1); }
}

.state__badge svg { display: block; width: 72px; height: 72px; }

.state__badge--success { color: var(--success); background: var(--success-soft); }
.state__badge--error { color: var(--danger); background: var(--danger-soft); animation-name: fade-in; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.state__ring {
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: draw-stroke .55s ease-out forwards .05s;
}

.state__check {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw-stroke .3s ease-out forwards .5s;
}

.state__exclaim { animation: fade-in .3s ease-out both .25s; }

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

.state__title {
  font-size: clamp(22px, 4.4vw, 27px);
  font-weight: 800;
  letter-spacing: -.02em;
}

.state__message {
  max-width: 46ch;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
}

.state__hint {
  margin: 16px auto 0;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  color: var(--faint);
  font-size: 12.5px;
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
  .page-shell { width: calc(100% - 14px); margin-top: 14px; }

  .card { border-radius: 15px; }

  .hero { padding: 18px 18px 16px; }
  .progress { padding: 14px 18px 0; }
  .alert { margin: 12px 18px 0; }
  .form { padding: 2px 18px 20px; }

  .question { padding: 16px 0; }
  .question:first-of-type { padding-top: 12px; }
  .question__help { margin-left: 0; }

  .rating__star { font-size: 33px; }
  .scale__pill { min-width: 40px; height: 40px; }
  .boolean__option { flex: 1 1 0; }
  .state { padding: 38px 20px 32px; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
