/* Fonts: Kalameh + IRANYekan + Inter via jsDelivr */
@font-face {
  font-family: "Kalameh";
  src: url("https://cdn.jsdelivr.net/gh/AmirAbbasVafaee/persian-fonts-cdn@main/fonts/kalameh/KalamehWeb(FaNum)-Black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Kalameh";
  src: url("https://cdn.jsdelivr.net/gh/AmirAbbasVafaee/persian-fonts-cdn@main/fonts/kalameh/KalamehWeb(FaNum)-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IRANYekan";
  src: url("https://cdn.jsdelivr.net/gh/AmirAbbasVafaee/persian-fonts-cdn@main/fonts/iran-yekan/IRANYekanWebRegular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IRANYekan";
  src: url("https://cdn.jsdelivr.net/gh/AmirAbbasVafaee/persian-fonts-cdn@main/fonts/iran-yekan/IRANYekanWebMedium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IRANYekan";
  src: url("https://cdn.jsdelivr.net/gh/AmirAbbasVafaee/persian-fonts-cdn@main/fonts/iran-yekan/IRANYekanWebBold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}


:root {
  color-scheme: light only;
  --brand-green: #007042;
  --brand-green-deep: #00562D;
  --brand-green-glow: rgba(0, 112, 66, 0.22);
  --brand-red: #B63C25;
  --brand-red-deep: #962E1A;
  --brand-red-glow: rgba(182, 60, 37, 0.22);
  --brand-gold: #9C7A4A;
  --brand-gold-deep: #7D5F34;
  --brand-gold-glow: rgba(156, 122, 74, 0.22);
  --paper: #FBF9F5;
  --white: #FFFFFF;
  --ink: #111B15;
  --ink-70: rgba(17, 27, 21, 0.72);
  --ink-40: rgba(17, 27, 21, 0.40);
  --line: rgba(17, 27, 21, 0.12);
  --border-card: #ECE6DB;
  --gradient-ribbon: linear-gradient(90deg, #007042 0%, #C49A45 50%, #B63C25 100%);
  --radius: 14px;
  --shadow-card: 0 4px 20px rgba(17, 27, 21, 0.05);
  --shadow-cta: 0 8px 24px rgba(0, 112, 66, 0.28);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
  background-color: var(--paper);
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  background-color: var(--paper);
  color: var(--ink);
  font-family: "IRANYekan", "Vazirmatn", Tahoma, Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  touch-action: manipulation;
}

/* Zero-Overflow Containers */
.container {
  width: min(100% - 24px, 600px);
  margin-inline: auto;
  box-sizing: border-box;
}

.page-shell {
  width: 100%;
  max-width: 100%;
  flex: 1;
  padding: 20px 0 52px;
  overflow-x: hidden;
}

/* Honeypot: Off-screen without pushing RTL layout */
.hp-field {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}

/* Accessible Skip Link */
.skip-link {
  position: absolute;
  top: -80px;
  inset-inline-start: 16px;
  background: var(--brand-green);
  color: var(--white);
  padding: 10px 18px;
  border-radius: 8px;
  font-family: "Kalameh", "IRANYekan", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  z-index: 9999;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 112, 66, 0.35);
  transition: top 0.2s ease;
}

.skip-link:focus-visible {
  top: 14px;
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

/* Decorative Framing Ribbons */
.frame-bar {
  width: 100%;
  max-width: 100%;
  height: 8px;
  background: var(--gradient-ribbon);
  flex-shrink: 0;
}

.frame-bar-top {
  position: sticky;
  top: 0;
  z-index: 101;
}

.frame-bar-bottom {
  margin-top: auto;
}

/* Sticky Progress Bar */
.progress-sticky {
  position: sticky;
  top: 8px;
  z-index: 100;
  width: 100%;
  max-width: 100%;
  background: rgba(251, 249, 245, 0.94);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px 8px;
  box-shadow: 0 4px 16px rgba(17, 27, 21, 0.03);
}

.progress-inner {
  max-width: 580px;
  margin: 0 auto 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-step-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.step-pill {
  font-family: "Kalameh", "IRANYekan", sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-green);
  background: rgba(0, 112, 66, 0.08);
  border: 1px solid rgba(0, 112, 66, 0.18);
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.step-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-70);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

@media (min-width: 480px) {
  .step-title {
    max-width: 260px;
  }
}

.progress-counter-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.progress-label {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink-70);
  white-space: nowrap;
}

.progress-percent {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-green);
  font-variant-numeric: tabular-nums;
  background: rgba(0, 112, 66, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0, 112, 66, 0.16);
  transition: background-color 0.25s ease, color 0.25s ease;
}

.progress-percent.completed {
  background: var(--brand-green);
  color: var(--white);
}

.progress-track {
  max-width: 580px;
  margin: 0 auto;
  height: 5px;
  background: #E8E2D6;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 100%;
  background: var(--gradient-ribbon);
  transform-origin: right center;
  transform: scaleX(0);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Salgirah 2026 Brand Hero */
.brand-hero {
  text-align: center;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.logo-stage {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
}

.logo-glow {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(196, 154, 69, 0.16) 0%, rgba(0, 112, 66, 0.06) 65%, transparent 75%);
}

.rosette-img {
  width: 88px;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0, 112, 66, 0.18));
}

.logo-entrance {
  opacity: 0;
  transform: scale(0.85);
  animation: logoAssemble 0.7s 0.1s cubic-bezier(0.18, 0.84, 0.26, 1) forwards;
}

@keyframes logoAssemble {
  to { opacity: 1; transform: scale(1); }
}

.english-lockup {
  text-align: center;
  margin-bottom: 12px;
}

.title-salgirah {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  font-size: clamp(2rem, 7vw, 2.65rem);
  color: var(--brand-red);
  letter-spacing: 0.14em;
  line-height: 1;
}

.lockup-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 210px;
  max-width: 75%;
  height: 1px;
  background-color: var(--brand-green);
  margin: 8px auto;
  opacity: 0.75;
  position: relative;
}

.divider-gem {
  width: 6px;
  height: 6px;
  background: var(--brand-gold);
  transform: rotate(45deg);
  position: absolute;
}

.subtitle-mubarak-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.subtitle-mubarak {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.15rem, 4.2vw, 1.45rem);
  color: var(--brand-green);
  letter-spacing: 0.18em;
}

.year-badge {
  font-family: "IRANYekan", "Vazirmatn", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand-green);
  border: 1px solid rgba(0, 112, 66, 0.35);
  background: rgba(0, 112, 66, 0.08);
  padding: 1px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.persian-title {
  font-family: "Kalameh", "IRANYekan", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 10px;
}

/* Wizard Pages */
.wizard-page {
  animation: pageFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.wizard-page[hidden] {
  display: none !important;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 4px;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-kicker {
  display: inline-block;
  width: 4px;
  height: 22px;
  border-radius: 2px;
  background: var(--brand-green);
  flex-shrink: 0;
}

.section-kicker-gold {
  background: var(--brand-gold);
}

.section-title {
  font-family: "Kalameh", "IRANYekan", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-green);
  line-height: 1.3;
}

.section-subtitle {
  font-size: 0.80rem;
  color: var(--ink-70);
  margin-top: 2px;
  font-weight: 400;
}

/* Wizard Navigation Footers */
.wizard-nav-footer {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
}

.wizard-nav-footer.dual-nav {
  display: grid;
  grid-template-columns: 124px 1fr;
  gap: 10px;
}

.nav-btn {
  min-height: 52px;
  font-size: 1rem;
}

.nav-btn-next {
  background: linear-gradient(135deg, var(--brand-green) 0%, var(--brand-green-deep) 100%);
  color: var(--white);
  box-shadow: var(--shadow-cta);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.nav-btn-next:hover {
  box-shadow: 0 10px 26px rgba(0, 112, 66, 0.35);
  transform: translateY(-1px);
}

.button-outline {
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.button-outline:hover {
  border-color: var(--ink-40);
  background-color: #F8F5EE;
}

.button-outline:active {
  transform: scale(0.97);
}

.nav-arrow {
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 0.15s ease;
}

.nav-btn-next:hover .nav-arrow {
  transform: translateX(-3px);
}

.nav-btn-prev:hover .nav-arrow {
  transform: translateX(3px);
}

.badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.badge-required {
  color: var(--brand-red);
  background: rgba(182, 60, 37, 0.08);
  border: 1px solid rgba(182, 60, 37, 0.18);
}

.badge-optional {
  color: var(--ink-70);
  background: #EFECE6;
  border: 1px solid rgba(17, 27, 21, 0.10);
}

.cards-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Individual Rating Card */
.rating-card {
  background: var(--white);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  padding: 14px 12px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
  scroll-margin-top: 66px;
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 11px;
}

.item-label {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.item-number {
  color: var(--brand-red);
  font-family: "Kalameh", "IRANYekan", sans-serif;
  font-weight: 700;
  font-size: 1rem;
}

.card-status {
  display: flex;
  align-items: center;
}

.status-badge {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--brand-green);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.status-badge.visible {
  opacity: 1;
}

.error-badge {
  display: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--white);
  background-color: var(--brand-red);
  padding: 2px 8px;
  border-radius: 999px;
  box-shadow: 0 2px 6px var(--brand-red-glow);
}

/* Card Error & Shake Animation */
.rating-card.card-error {
  border-color: var(--brand-red);
  background-color: #FFF7F5;
  box-shadow: 0 4px 16px var(--brand-red-glow);
  animation: cardShake 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.rating-card.card-error .error-badge {
  display: inline-block;
}

.rating-card.card-error .status-badge {
  display: none;
}

@keyframes cardShake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
  40%, 60% { transform: translate3d(5px, 0, 0); }
}

/* Single-Row 5-Pill Grid (No horizontal overflow guaranteed) */
.pill-group {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  width: 100%;
}

.pill-btn {
  min-height: 46px;
  padding: 8px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  font-family: inherit;
  font-size: clamp(0.70rem, 2.9vw, 0.88rem);
  font-weight: 500;
  border-radius: 10px;
  border: 1px solid var(--line);
  background-color: var(--white);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.14s ease, background-color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, color 0.14s ease;
}

.pill-btn:hover {
  border-color: #C9BFB0;
  background-color: #F8F5EE;
}

.pill-btn:active {
  transform: scale(0.95);
}

.pill-btn:focus-visible {
  outline: 2px solid var(--brand-green);
  outline-offset: 2px;
}

/* Active Color-Coded Ratings */
.pill-btn.active[data-score="5"],
.pill-btn.active[data-score="4"] {
  background: linear-gradient(135deg, var(--brand-green) 0%, var(--brand-green-deep) 100%);
  border-color: var(--brand-green);
  color: var(--white);
  font-weight: 700;
  box-shadow: 0 3px 10px var(--brand-green-glow);
}

.pill-btn.active[data-score="3"] {
  background: linear-gradient(135deg, var(--brand-gold) 0%, var(--brand-gold-deep) 100%);
  border-color: var(--brand-gold);
  color: var(--white);
  font-weight: 700;
  box-shadow: 0 3px 10px var(--brand-gold-glow);
}

.pill-btn.active[data-score="2"],
.pill-btn.active[data-score="1"] {
  background: linear-gradient(135deg, var(--brand-red) 0%, var(--brand-red-deep) 100%);
  border-color: var(--brand-red);
  color: var(--white);
  font-weight: 700;
  box-shadow: 0 3px 10px var(--brand-red-glow);
}

/* Textarea Card */
.textarea-card {
  padding: 16px 14px;
}

textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 16px; /* Prevents iOS auto-zoom */
  color: var(--ink);
  background-color: var(--white);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  resize: vertical;
  min-height: 115px;
  line-height: 1.6;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea:focus-visible {
  outline: none;
  border-color: var(--brand-green);
  box-shadow: 0 0 0 3px rgba(0, 112, 66, 0.14);
}

.char-counter {
  margin-top: 6px;
  text-align: left;
  font-size: 0.76rem;
  color: var(--ink-40);
  font-variant-numeric: tabular-nums;
}

/* Alert Banner */
.form-alert {
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 0.90rem;
  font-weight: 600;
  margin-bottom: 18px;
  text-align: center;
  border: 1px solid transparent;
}

.form-alert.error {
  background-color: #FEE8E6;
  color: #921E12;
  border-color: #F8B4AC;
}

/* Submit Actions */
.submit-action {
  margin-top: 8px;
}

.button {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  font-family: "Kalameh", "IRANYekan", sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  padding: 14px 24px;
  cursor: pointer;
  transition: transform 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.submit-button {
  width: 100%;
  background: linear-gradient(135deg, var(--brand-green) 0%, var(--brand-green-deep) 100%);
  color: var(--white);
  box-shadow: var(--shadow-cta);
}

.submit-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 112, 66, 0.35);
}

.submit-button:active:not(:disabled) {
  transform: translateY(1px);
}

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

.submit-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.submit-btn-content {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* Thank You Screen */
.confirmation-card {
  background: var(--white);
  border: 1px solid var(--border-card);
  border-radius: 18px;
  padding: 38px 20px;
  text-align: center;
  box-shadow: var(--shadow-card);
  margin-top: 14px;
}

.confirmation-emblem {
  margin-bottom: 14px;
}

.confirmation-emblem img {
  display: inline-block;
  filter: drop-shadow(0 4px 12px rgba(0, 112, 66, 0.18));
}

.success-badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 112, 66, 0.12);
  color: var(--brand-green);
  font-size: 1.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  border: 1px solid rgba(0, 112, 66, 0.20);
}

.confirmation-title {
  font-family: "Kalameh", "IRANYekan", sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--brand-green);
  margin-bottom: 8px;
}

.confirmation-text {
  font-size: 0.94rem;
  color: var(--ink-70);
  margin-bottom: 16px;
  line-height: 1.7;
}

.confirmation-timestamp {
  font-size: 0.80rem;
  color: var(--ink-40);
  margin-bottom: 24px;
}

.button-secondary {
  border: 1.5px solid var(--brand-red);
  background: var(--white);
  color: var(--brand-red);
  padding: 12px 26px;
  font-size: 0.96rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.button-secondary:hover {
  background-color: var(--brand-red);
  color: var(--white);
}

.button-secondary:active {
  transform: scale(0.97);
}

.button-secondary:focus-visible {
  outline: 2px solid var(--brand-red);
  outline-offset: 2px;
}

.btn-icon {
  flex-shrink: 0;
}

/* Tablet / Desktop */
@media (min-width: 768px) {
  .page-shell {
    padding: 32px 0 64px;
  }
  .rating-card {
    padding: 16px 18px;
  }
  .pill-group {
    gap: 6px;
  }
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
