/* CAG Cut — Clothier Survey
   Palette and type meant to read like a cutting ticket, not a form builder. */

:root {
  --paper: #e7e0d0;
  --card: #f1ebdc;
  --ink: #262220;
  --oxblood: #6c2a38;
  --bottle: #33463a;
  --brass: #a2803f;

  --ink-soft: rgba(38, 34, 32, 0.62);
  --ink-faint: rgba(38, 34, 32, 0.14);
  --brass-faint: rgba(162, 128, 63, 0.32);

  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --radius: 3px;
  --shell: 34rem;
}

* {
  box-sizing: border-box;
}

/* Author `display` rules below (e.g. .footer { display: flex }) would otherwise
   beat the user-agent [hidden] rule and keep hidden elements on screen. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--paper);
  /* Faint weave, so the paper has a texture without a bitmap. */
  background-image:
    repeating-linear-gradient(90deg, rgba(38, 34, 32, 0.022) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(38, 34, 32, 0.022) 0 1px, transparent 1px 3px);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 1.5rem 1.15rem 0;
}

/* ------------------------------------------------------------- masthead -- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--brass-faint);
}

.wordmark {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  font-variation-settings: 'SOFT' 0, 'WONK' 1, 'opsz' 20;
  letter-spacing: 0.01em;
}

.wordmark em {
  font-style: normal;
  color: var(--oxblood);
}

.masthead-note {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  white-space: nowrap;
}

/* ------------------------------------------------------------- progress -- */

.progress {
  padding: 1.1rem 0 0.25rem;
}

.progress-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.progress-pct {
  color: var(--brass);
}

.progress-track {
  position: relative;
  height: 3px;
  margin-top: 0.6rem;
  background: rgba(38, 34, 32, 0.1);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--oxblood);
  transition: width 340ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ----------------------------------------------------------------- card -- */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0 0;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(38, 34, 32, 0.16);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 8px 24px -18px rgba(38, 34, 32, 0.7);
  padding: 1.5rem 1.25rem 1.4rem;
}

/* Stitched inner rule, like a seam allowance on a pattern piece. */
.card::after {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(162, 128, 63, 0.28);
  border-radius: 2px;
  pointer-events: none;
}

.card > * {
  position: relative;
  z-index: 1;
}

.question-head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

/* The signature mill stamp / wax seal. */
.stamp {
  flex: 0 0 auto;
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--oxblood);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3px rgba(108, 42, 56, 0.42);
  color: var(--oxblood);
  font-family: var(--mono);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  transform: rotate(-7deg);
  opacity: 0.92;
}

.stamp-optional {
  border-color: var(--bottle);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3px rgba(51, 70, 58, 0.38);
  color: var(--bottle);
}

.question-meta {
  padding-top: 0.15rem;
}

.question-kicker {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 0.4rem;
}

.question-prompt {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 600;
  font-variation-settings: 'SOFT' 0, 'WONK' 1, 'opsz' 24;
  line-height: 1.28;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}

/* -------------------------------------------------------------- options -- */

.options {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.7rem 0.9rem;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(38, 34, 32, 0.2);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.97rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, transform 90ms ease;
  -webkit-tap-highlight-color: transparent;
}

.option:hover {
  border-color: rgba(108, 42, 56, 0.55);
}

.option:active {
  transform: translateY(1px);
}

.option-mark {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  border: 1.5px solid rgba(38, 34, 32, 0.34);
  border-radius: 50%;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.option[aria-pressed='true'] {
  background: rgba(108, 42, 56, 0.09);
  border-color: var(--oxblood);
  box-shadow: 0 0 0 1px var(--oxblood);
}

.option[aria-pressed='true'] .option-mark {
  border-color: var(--oxblood);
  box-shadow: inset 0 0 0 3.5px var(--oxblood);
}

/* ---------------------------------------------------------------- scale -- */

.scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}

.scale-button {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(38, 34, 32, 0.2);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1.05rem;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, transform 90ms ease;
  -webkit-tap-highlight-color: transparent;
}

.scale-button:hover {
  border-color: rgba(108, 42, 56, 0.55);
}

.scale-button:active {
  transform: translateY(1px);
}

.scale-button[aria-pressed='true'] {
  background: var(--oxblood);
  border-color: var(--oxblood);
  color: var(--card);
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.65rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ----------------------------------------------------------------- text -- */

.text-input {
  width: 100%;
  min-height: 8.5rem;
  padding: 0.8rem 0.85rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(38, 34, 32, 0.22);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  resize: vertical;
}

.text-input-single {
  min-height: 3.25rem;
  height: 3.25rem;
  padding: 0 0.85rem;
  resize: none;
}

.text-input::placeholder {
  color: rgba(38, 34, 32, 0.38);
}

.text-input:focus {
  outline: none;
  border-color: var(--bottle);
  box-shadow: 0 0 0 1px var(--bottle);
}

.optional-note {
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* -------------------------------------------------------------- footer -- */

.footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.15rem;
  padding: 0.9rem 0 1.15rem;
  background: linear-gradient(to bottom, rgba(231, 224, 208, 0) 0%, var(--paper) 26%);
}

.btn {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease, opacity 140ms ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  flex: 1;
  min-height: 3.1rem;
  padding: 0 1.25rem;
  background: var(--oxblood);
  border: 1px solid var(--oxblood);
  color: #f4ece0;
}

.btn-primary:hover:not(:disabled) {
  background: #5b222f;
}

.btn-primary:disabled {
  background: rgba(38, 34, 32, 0.14);
  border-color: transparent;
  color: rgba(38, 34, 32, 0.42);
  cursor: not-allowed;
}

.btn-back {
  min-height: 3.1rem;
  padding: 0 1rem;
  background: transparent;
  border: 1px solid rgba(38, 34, 32, 0.28);
  color: var(--ink-soft);
}

.btn-back:hover:not(:disabled) {
  border-color: var(--ink);
  color: var(--ink);
}

.btn-back:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.hint {
  margin: 0.7rem 0 0;
  min-height: 1rem;
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--oxblood);
  text-align: center;
}

/* --------------------------------------------------------------- done -- */

.done {
  text-align: center;
  padding: 2.4rem 1.25rem 2.6rem;
}

.done .stamp {
  margin: 0 auto 1.35rem;
  width: 3.6rem;
  height: 3.6rem;
  font-size: 1.5rem;
  transform: rotate(-9deg);
}

.done h2 {
  margin: 0 0 0.7rem;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  font-variation-settings: 'SOFT' 0, 'WONK' 1, 'opsz' 28;
  letter-spacing: -0.01em;
}

.done p {
  margin: 0 auto;
  max-width: 24rem;
  color: var(--ink-soft);
  font-size: 0.97rem;
  text-wrap: pretty;
}

.done-rule {
  width: 3rem;
  height: 1px;
  margin: 1.4rem auto 0;
  background: var(--brass);
}

/* ------------------------------------------------------------ intro/etc -- */

.intro {
  text-align: left;
  padding: 1.9rem 1.35rem 1.7rem;
}

.intro h2 {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  font-variation-settings: 'SOFT' 0, 'WONK' 1, 'opsz' 28;
  line-height: 1.22;
  letter-spacing: -0.01em;
}

.intro p {
  margin: 0 0 0.9rem;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.intro ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass);
}

.intro li {
  padding: 0.42rem 0;
  border-top: 1px solid var(--brass-faint);
}

.colophon {
  padding: 0.9rem 0 1.4rem;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(38, 34, 32, 0.36);
  text-align: center;
}

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

.enter {
  animation: enter 300ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 34rem) {
  .shell {
    padding-top: 2.75rem;
  }
  .card {
    padding: 1.9rem 1.75rem 1.75rem;
  }
  .question-prompt {
    font-size: 1.42rem;
  }
  .intro {
    padding: 2.3rem 1.75rem 2rem;
  }
}
