/* Pendant lettering falls back to bundled-safe system fonts until the custom font files are added. */

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --brand: #FC4400;
  --brand-light: #FFF0EB;
  --olive: #6C6D47;
  --yellow: #FFD239;
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --text: #1A1A1A;
  --text-secondary: #666;
  --border: #E5E5E0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.2s ease;
  --content-width: 480px;
  --page-padding: 20px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* === Page container — single column grid === */
.page {
  max-width: calc(var(--content-width) + var(--page-padding) * 2);
  margin: 0 auto;
  padding: 0 var(--page-padding);
}

/* === Header with R.O. logo === */
.header {
  padding: 32px 0 16px;
  text-align: center;
}

.header__logo-svg {
  width: 72px;
  height: auto;
}

/* === Greeting — same grid as everything === */
.greeting {
  text-align: center;
  padding: 8px 0 28px;
}

.greeting__title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.3;
}

.greeting__subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* === Constructor Container === */
.constructor {
  padding: 0 0 80px;
}

/* === Sticky Preview === */
.preview {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  padding: 16px 16px 12px;
  margin: 0 calc(var(--page-padding) * -1);
  margin-bottom: 20px;
  width: calc(100% + var(--page-padding) * 2);
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* When preview should unstick (past customization zone) */
.preview--unstuck {
  position: relative;
}

.preview__container {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview__container svg {
  width: 100%;
  height: auto;
  max-height: 140px;
}

/* === Steps === */
.step {
  padding: 24px 0 8px;
}

.step__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.step__hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.step--result {
  text-align: center;
  padding: 24px 0;
}

.step--result .step__title {
  font-size: 1.3rem;
  color: var(--brand);
}

/* Delivery section gets a subtle divider */
.step--delivery {
  padding-top: 32px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

/* === Word Input === */
.word-input {
  position: relative;
  margin-bottom: 20px;
}

.word-input input {
  width: 100%;
  font-family: var(--font);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-align: center;
  text-transform: uppercase;
  padding: 14px 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}

.word-input input:focus {
  border-color: var(--brand);
}

.word-input input::placeholder {
  color: #CCC;
  font-weight: 500;
}

.word-input__counter {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 20px;
}

/* === Letter Color Pickers === */
.letter-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 8px;
}

.letter-color-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.letter-color-group__char {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0;
  transition: color var(--transition);
  line-height: 1;
}

.letter-color-group__dots {
  display: flex;
  gap: 4px;
}

.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
  outline: none;
}

.color-dot:hover {
  transform: scale(1.15);
}

.color-dot--active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--text);
}

/* === Rainbow Option === */
.rainbow-option {
  text-align: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.rainbow-option__hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.rainbow-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border: 2px solid var(--border);
  border-radius: 50px;
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  transition: all var(--transition);
}

.rainbow-btn:hover {
  border-color: #999;
  transform: scale(1.03);
}

.rainbow-btn--active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text);
}

.rainbow-btn__dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: conic-gradient(#FF4D6A, #FFD439, #BFFF00, #42D4F4, #7B68EE, #FF69B4, #FF4D6A);
  flex-shrink: 0;
}

.rainbow-btn__label {
  white-space: nowrap;
}

.rainbow-option__note {
  font-size: 0.78rem;
  color: #999;
  margin-top: 10px;
  line-height: 1.4;
}

/* === Swatches (Cord & Carabiner) === */
.swatches {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
  outline: none;
  position: relative;
}

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

.swatch--active {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text);
}

.swatch__label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 4px;
}

/* === Form === */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  font-family: var(--font);
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #BBB;
}

.label-optional {
  font-weight: 400;
  color: #999;
  font-size: 0.85em;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* === Submit Button === */
.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  margin-top: 20px;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  background: var(--brand);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.submit-btn:hover {
  background: #E03D00;
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn:disabled {
  background: linear-gradient(135deg, rgba(252, 68, 0, 0.82), rgba(252, 68, 0, 0.65));
  color: rgba(255, 255, 255, 0.98);
  cursor: progress;
  transform: none;
  box-shadow: 0 10px 24px rgba(252, 68, 0, 0.18);
}

.submit-btn__spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #FFF;
  animation: spin 0.75s linear infinite;
  display: none;
  flex-shrink: 0;
}

.submit-btn__label {
  position: relative;
}

.submit-btn:disabled .submit-btn__spinner {
  display: inline-block;
}

.submit-btn:disabled .submit-btn__label {
  animation: submitPulse 1.4s ease-in-out infinite;
}

.submit-feedback {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(252, 68, 0, 0.08), rgba(252, 68, 0, 0.03));
  border: 1px solid rgba(252, 68, 0, 0.12);
  color: var(--text);
}

.submit-feedback__pulse {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 0 rgba(252, 68, 0, 0.35);
  animation: signalPulse 1.5s ease-out infinite;
  flex-shrink: 0;
}

.submit-feedback__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.submit-feedback__title {
  font-size: 0.93rem;
  font-weight: 700;
}

.submit-feedback__message {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.order-form--submitting .form-group input,
.order-form--submitting .form-group textarea {
  background: rgba(255, 255, 255, 0.8);
}

.order-form--submitting .form-group label {
  color: rgba(26, 26, 26, 0.72);
}

/* === Thank You === */
.thank-you {
  text-align: center;
  padding: 80px 0;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.thank-you__icon {
  margin-bottom: 24px;
}

.thank-you__logo {
  width: 80px;
  height: auto;
}

.thank-you__title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--brand);
  margin-bottom: 12px;
}

.thank-you__text {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* === Swatch Group === */
.swatch-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* === Letter Colors Hint === */
.letter-colors__hint {
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* === Shake Animation === */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.shake {
  animation: shake 0.4s ease;
}

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

@keyframes submitPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

@keyframes signalPulse {
  0% {
    transform: scale(0.92);
    box-shadow: 0 0 0 0 rgba(252, 68, 0, 0.35);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(252, 68, 0, 0);
  }
  100% {
    transform: scale(0.92);
    box-shadow: 0 0 0 0 rgba(252, 68, 0, 0);
  }
}

/* === Utility === */
.hidden {
  display: none !important;
}

/* === Responsive === */
@media (max-width: 380px) {
  .greeting__title {
    font-size: 1.2rem;
  }

  .word-input input {
    font-size: 1.1rem;
    padding: 12px 16px;
  }

  .letter-color-group__char {
    font-size: 1.1rem;
  }

  .swatch {
    width: 38px;
    height: 38px;
  }
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  max-width: 90vw;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 1000;
  pointer-events: none;
}

.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
