/* Story 2.1a — WF-1 web fallback form styles.
   Colour tokens mirror lib/core/theme/colours.dart (AppColours) so the
   fallback page reads as the same product as the Flutter app. */

:root {
  --green-deep: #1a4731;
  --green-sage: #52b788;
  --gold-warm: #c9a84c;
  --gold-light: #f4d98a;
  --bg-primary: #fafaf7;
  --bg-secondary: #f5f0e8;
  --text-primary: #1c1c1e;
  --text-secondary: #48484a;
  --text-tertiary: #8e8e93;
  --text-inverse: #fafaf7;
  --error: #dc2626;
  --success: #059669;
  --radius-xl: 16px;
  --radius-md: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  /* Ensures the first scroll on a 320dp viewport never reveals the store
     links before the form/CTA (ux-spec.md WF-1 interaction rule). */
  align-items: flex-start;
}

.page {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 24px 16px 48px;
}

.card {
  width: 100%;
  max-width: 480px;
}

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* The `.state { display: flex }` rule above has the same specificity as the
   browser's default `[hidden] { display: none }` UA-stylesheet rule, and
   author styles win ties — without this, a hidden state section would still
   render visually despite its `hidden` attribute being set. */
.state[hidden] {
  display: none;
}

.bismillah {
  font-size: 32px;
  color: var(--gold-warm);
  margin: 8px 0 16px;
}

.check-icon {
  font-size: 40px;
  margin: 8px 0 16px;
}

.heading-2 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.body-regular {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0 0 24px;
}

.loading-text {
  color: var(--text-tertiary);
  padding: 48px 0;
}

form {
  width: 100%;
  text-align: start;
  margin-top: 8px;
}

.field {
  margin-bottom: 20px;
}

.field label,
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

#name-input,
#note-input {
  width: 100%;
  border: 1px solid #e2ddd0;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text-primary);
}

#name-input {
  height: 52px;
}

#note-input {
  min-height: 80px;
  max-height: 160px;
  padding-top: 12px;
  padding-bottom: 12px;
  resize: vertical;
  overflow-y: auto;
}

#name-input:focus,
#note-input:focus {
  outline: 2px solid var(--gold-warm);
  outline-offset: 1px;
}

.counter {
  display: block;
  text-align: end;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.counter.counter-warn {
  color: var(--error);
}

.segmented {
  display: flex;
  gap: 10px;
}

.segment {
  flex: 1;
  padding: 14px 8px;
  border: 2px solid #e2ddd0;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

.segment.selected {
  border-color: var(--gold-warm);
  background: var(--bg-secondary);
}

.cta-primary {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: var(--radius-xl);
  background: var(--gold-warm);
  color: var(--green-deep);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.cta-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cta-primary.loading {
  opacity: 0.75;
  cursor: wait;
}

.cta-secondary {
  height: 44px;
  padding: 0 24px;
  border: 1px solid var(--gold-warm);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--green-deep);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.inline-error {
  background: #fdecea;
  color: var(--error);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: start;
}

.store-links {
  width: 100%;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e2ddd0;
}

.caption {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0 0 10px;
}

.store-badges {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.store-badge {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid #d8d2c2;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  /* "never larger than the name input field" per ux-spec.md WF-1 spec */
  max-height: 52px;
}

.store-badges-large .store-badge {
  padding: 10px 20px;
  font-size: 14px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (min-width: 480px) {
  .page {
    padding-top: 48px;
  }
}
