@import url('tokens.css');

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

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  font-size: var(--text-base);
  line-height: 1.47059;
  letter-spacing: -0.022em;
  color: var(--text);
  background: var(--bg);
}

/* Minimal nav on form pages */
.form-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(var(--nav-blur));
  -webkit-backdrop-filter: saturate(180%) blur(var(--nav-blur));
  border-bottom: 1px solid var(--border-subtle);
}

.form-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--section-max-width);
  margin: 0 auto;
  padding: 0 var(--section-padding-x);
  min-height: var(--nav-height);
}

.form-header__brand {
  margin-left: auto;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.form-header__brand:hover {
  text-decoration: none;
  opacity: 0.8;
}

/* Apple-Navigation: ‹ links, Zurück linksbündig */
.form-header__back {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--link);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.form-header__back:hover {
  text-decoration: none;
  opacity: 0.72;
}

.form-header__chevron {
  font-size: 1.375rem;
  font-weight: 400;
  line-height: 1;
  margin-top: -0.1em;
}

.shell {
  width: min(100%, 40rem);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3rem) var(--section-padding-x)
    clamp(2.5rem, 6vw, 4rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.shell.wide {
  width: min(100%, 52rem);
}

.form-hero {
  text-align: center;
  padding: 0 0 0.5rem;
}

.form-hero h1 {
  margin: 0 0 0.5rem;
  font-size: var(--h2);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.form-hero p {
  margin: 0 auto;
  max-width: 28rem;
  font-size: var(--text-lg);
  line-height: 1.4;
  letter-spacing: -0.02em;
  color: var(--muted);
}

/* Alias for existing markup */
.hero h1 {
  margin: 0 0 0.5rem;
  font-size: var(--h2);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}
.hero p {
  margin: 0 auto;
  max-width: 28rem;
  font-size: var(--text-lg);
  line-height: 1.4;
  letter-spacing: -0.02em;
  color: var(--muted);
}

.form-card {
  background: var(--bg-alt);
  border: none;
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 2rem);
}

.form-card h2 {
  margin: 0 0 0.5rem;
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

label,
.field-label {
  font-weight: 500;
  font-size: var(--text-sm);
  display: block;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.hint {
  color: var(--muted);
  font-size: var(--text-sm);
  margin: 0 0 1rem;
  line-height: 1.4;
}

textarea,
input[type="text"],
input[type="date"] {
  width: 100%;
  font: inherit;
  font-size: var(--text-base);
  padding: 0.875rem 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  line-height: 1.5;
  letter-spacing: -0.022em;
  transition: box-shadow 0.2s ease;
}

textarea {
  min-height: clamp(7rem, 22vh, 10rem);
  resize: vertical;
}

textarea:focus,
input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
}

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.field-block {
  margin-bottom: 1.25rem;
}

.counter {
  text-align: right;
  color: var(--muted);
  font-size: var(--text-xs);
  margin: 0.35rem 0 0;
}

.mood-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.mood-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: none;
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  cursor: pointer;
  background: var(--surface);
  font-weight: 400;
  transition: background 0.15s ease;
}

.mood-option:hover {
  background: #ebebed;
}

.mood-option input {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--accent);
}

.mood-option span {
  font-size: var(--text-base);
  letter-spacing: -0.022em;
}

.mood-option input:checked + span {
  font-weight: 500;
}

.selection-ring {
  display: none;
}

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1.5rem;
}

button {
  font: inherit;
  font-weight: 500;
  font-size: var(--text-sm);
  cursor: pointer;
  border-radius: 980px;
  padding: 0.65rem 1.5rem;
  border: none;
  letter-spacing: -0.01em;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--surface);
}

.btn-primary:hover {
  background: var(--accent-hover);
  opacity: 1;
}

.btn-secondary {
  background: transparent;
  color: var(--link);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--text);
  background: transparent;
}

.notice {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
}

.notice.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.notice.err {
  background: var(--err-bg);
  color: var(--err);
}

.notice.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

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

.form-footer {
  text-align: center;
  color: var(--muted);
  font-size: var(--text-xs);
  padding-top: 0.5rem;
}

.form-footer p {
  margin: 0;
}

.row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-card .subtitle {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.form-card .description {
  margin: 0.75rem 0 1rem;
  font-size: var(--text-base);
  color: var(--text);
  line-height: 1.47;
}

.fieldset {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.required {
  color: var(--muted);
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.875rem 1rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--surface);
}

.option:hover {
  background: #ebebed;
}

.option input {
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.matrix {
  overflow-x: auto;
}

.matrix-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  gap: 0.35rem;
  align-items: center;
}

.matrix-header {
  font-weight: 500;
  font-size: var(--text-xs);
  text-align: center;
  color: var(--muted);
  padding: 0.25rem;
}

.matrix-rowlabel {
  font-weight: 500;
  font-size: var(--text-sm);
}

.matrix-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem;
  cursor: pointer;
  background: var(--input-bg);
}

.matrix-cell:hover {
  background: #ebebed;
}

.matrix-cell input {
  appearance: none;
  width: 0;
  height: 0;
  margin: 0;
}

.matrix-cell span {
  font-size: 1rem;
  opacity: 0;
  color: var(--text);
}

.matrix-cell input:checked + span {
  opacity: 1;
}

.field-error {
  color: var(--err);
  font-size: var(--text-xs);
  margin: 0.25rem 0 0;
}

@media (max-width: 640px) {
  .mood-option {
    min-width: 100%;
  }
}
