/* vazirmatn-arabic-wght-normal */
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("./assets/fonts/vazirmatn-arabic-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011,
    U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF,
    U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B,
    U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D,
    U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89,
    U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}

/* vazirmatn-latin-ext-wght-normal */
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("./assets/fonts/vazirmatn-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* vazirmatn-latin-wght-normal */
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("./assets/fonts/vazirmatn-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
    U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --nema-font: "Vazirmatn", "Tahoma", "Arial", sans-serif;
  --nema-primary: #0f6d63;
  --nema-primary-hover: #0b5a52;
  --nema-accent: #f4c75f;
  --nema-bg: #f6efe7;
  --nema-surface: #fffdf8;
  --nema-surface-alt: #f2f9f8;
  --nema-text: #1f2b2d;
  --nema-text-muted: #5b6769;
  --nema-border: #dbe4e3;
  --nema-success: #1f8f60;
  --nema-success-bg: #e8f8ef;
  --nema-error: #b0403f;
  --nema-error-bg: #fff1f0;
  --nema-radius: 18px;
  --nema-shadow: 0 18px 52px rgba(14, 38, 41, 0.26);
}

.nema-tryon-button {
  appearance: none;
  border: 0;
  border-radius: calc(var(--nema-radius) - 8px);
  background: linear-gradient(135deg, var(--nema-primary) 0%, #138374 100%);
  color: #fff;
  font: 700 15px/1 var(--nema-font);
  letter-spacing: 0.01em;
  min-height: 46px;
  padding: 0 18px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
  box-shadow: 0 8px 20px rgba(15, 109, 99, 0.24);
}

.nema-tryon-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 109, 99, 0.26);
}

.nema-tryon-button:active {
  transform: translateY(0);
}

.nema-tryon-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--nema-accent) 70%, #fff 30%);
  outline-offset: 2px;
}

.nema-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4vh 0;
  box-sizing: border-box;
  font-family: var(--nema-font);
  direction: rtl;
  text-align: right;
}

.nema-modal.is-open {
  display: block;
}

.nema-modal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 10% 10%, rgba(244, 199, 95, 0.16) 0%, transparent 45%),
    rgba(10, 23, 30, 0.58);
  backdrop-filter: blur(4px);
}

.nema-modal-card {
  position: relative;
  margin: 0 auto;
  width: min(92vw, 680px);
  color: var(--nema-text);
  background: linear-gradient(145deg, var(--nema-surface) 0%, var(--nema-surface-alt) 100%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--nema-radius);
  padding: 24px 24px 18px;
  box-shadow: var(--nema-shadow);
  max-height: calc(100vh - 8vh);
  max-height: calc(100dvh - 8vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  animation: nema-modal-enter 180ms ease forwards;
}

@keyframes nema-modal-enter {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.nema-close {
  appearance: none;
  position: absolute;
  left: 12px;
  top: 12px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--nema-border);
  border-radius: 10px;
  background: #fff;
  color: var(--nema-text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.nema-header {
  margin-right: 0;
}

.nema-kicker,
.nema-header h2,
.nema-subtitle {
  padding-inline-end: 44px;
}

.nema-kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nema-primary);
}

.nema-header h2 {
  margin: 8px 0 0;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1.2;
}

.nema-subtitle {
  margin: 8px 0 14px;
  color: var(--nema-text-muted);
  font-size: 0.96rem;
}

.nema-stepper {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(108px, max-content));
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.nema-step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--nema-border);
  background: #fff;
  color: var(--nema-text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.nema-step-index {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  background: #edf3f2;
  color: #485356;
}

.nema-step.is-active {
  border-color: color-mix(in srgb, var(--nema-primary) 42%, #fff 58%);
  color: var(--nema-text);
}

.nema-step.is-active .nema-step-index {
  background: var(--nema-primary);
  color: #fff;
}

.nema-step.is-complete {
  border-color: color-mix(in srgb, var(--nema-success) 45%, #fff 55%);
  color: var(--nema-success);
}

.nema-step.is-complete .nema-step-index {
  background: var(--nema-success-bg);
  color: var(--nema-success);
}

.nema-copy {
  margin-top: 12px;
  border: 1px solid var(--nema-border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.88);
}

.nema-guidance,
.nema-privacy {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--nema-text-muted);
}

.nema-privacy {
  margin-top: 6px;
}

.nema-upload-panel {
  margin-top: 14px;
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--nema-border);
}

.nema-file-label {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--nema-text);
}

.nema-file-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  border: 1px dashed color-mix(in srgb, var(--nema-primary) 35%, #cfd8d7 65%);
  border-radius: 12px;
  padding: 12px;
  background: #f9fefd;
}

.nema-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.nema-file-trigger {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: #e7f5f3;
  color: var(--nema-primary);
  font: 700 0.82rem/1 var(--nema-font);
  cursor: pointer;
  flex: 0 0 auto;
}

.nema-file-name {
  flex: 1 1 180px;
  min-width: 0;
  font: 600 0.88rem/1.2 var(--nema-font);
  color: var(--nema-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nema-file-name.is-empty {
  color: var(--nema-text-muted);
}

.nema-file-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--nema-text-muted);
}

.nema-preview-card {
  margin-top: 12px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--nema-border);
  background: #f8fbfb;
}

.nema-fit-preferences {
  margin-top: 12px;
  border-top: 1px solid var(--nema-border);
  padding-top: 12px;
}

.nema-fit-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--nema-text);
  cursor: pointer;
}

.nema-fit-adjustment-input {
  width: 18px;
  height: 18px;
  accent-color: var(--nema-primary);
  cursor: pointer;
}

.nema-preview-label {
  margin: 0;
  padding: 8px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--nema-text-muted);
  border-bottom: 1px solid var(--nema-border);
}

.nema-original-image {
  display: block;
  width: 100%;
  height: clamp(180px, 32vh, 240px);
  object-fit: contain;
  object-position: center top;
}

.nema-progress {
  margin-top: 12px;
  border: 1px solid var(--nema-border);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.nema-progress-track {
  display: block;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #ecf2f2;
  overflow: hidden;
}

.nema-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(270deg, var(--nema-primary) 0%, #22b4a0 100%);
  transition: width 360ms ease;
  margin-right: auto;
  margin-left: 0;
}

.nema-progress-label {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--nema-text-muted);
}

.nema-status {
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 10px 12px;
  min-height: 42px;
  font-size: 0.87rem;
  line-height: 1.35;
  display: flex;
  align-items: center;
}

.nema-status.is-empty {
  display: none;
}

.nema-status--info {
  background: #eef7f6;
  border-color: #cae3e0;
  color: #235f58;
}

.nema-status--success {
  background: var(--nema-success-bg);
  border-color: #b5e7cb;
  color: var(--nema-success);
}

.nema-status--error {
  background: var(--nema-error-bg);
  border-color: #f4c2bf;
  color: var(--nema-error);
}

.nema-result-panel {
  margin-top: 12px;
  border-radius: 14px;
  border: 1px solid var(--nema-border);
  background: #fff;
  padding: 12px;
}

.nema-refine-helper {
  margin: 12px 0 0;
  font-size: 0.8rem;
  color: var(--nema-text-muted);
}

.nema-result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.nema-view-toggle {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid var(--nema-border);
  padding: 2px;
  background: #f8fcfb;
}

.nema-view-button,
.nema-fullscreen {
  appearance: none;
  border: 0;
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
  font: 700 0.8rem/1 var(--nema-font);
  cursor: pointer;
}

.nema-view-button {
  background: transparent;
  color: var(--nema-text-muted);
}

.nema-view-button.is-active {
  background: var(--nema-primary);
  color: #fff;
}

.nema-fullscreen {
  border-radius: 10px;
  border: 1px solid var(--nema-border);
  background: #fff;
  color: var(--nema-text);
}

.nema-result-canvas {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  min-height: min(58vh, 520px);
  background: linear-gradient(145deg, #f3f8f8 0%, #fdfdfc 100%);
  border: 1px solid #e7efee;
}

.nema-result-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #eef4f3 20%, #f7fbfa 45%, #eef4f3 70%);
  background-size: 220% 100%;
  animation: nema-skeleton 1.3s linear infinite;
}

@keyframes nema-skeleton {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -100% 0;
  }
}

.nema-result-image,
.nema-original-result {
  display: block;
  width: 100%;
  height: min(58vh, 520px);
  object-fit: contain;
  margin-left: auto;
  margin-right: auto;
}

.nema-actions {
  position: sticky;
  bottom: -18px;
  z-index: 2;
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 12px 12px calc(var(--nema-radius) - 2px) calc(var(--nema-radius) - 2px);
  background: rgba(255, 253, 248, 0.92);
  border-top: 1px solid #e2eceb;
  backdrop-filter: blur(6px);
}

.nema-submit,
.nema-refine-less-tight,
.nema-retry,
.nema-close-action {
  appearance: none;
  border: 0;
  border-radius: 10px;
  min-height: 42px;
  padding: 0 12px;
  font: 700 0.83rem/1 var(--nema-font);
  cursor: pointer;
  transition: transform 100ms ease, opacity 100ms ease;
}

.nema-submit {
  grid-column: 1 / -1;
  color: #fff;
  background: var(--nema-primary);
}

.nema-refine-less-tight {
  color: var(--nema-primary);
  background: #e7f5f3;
  border: 1px solid color-mix(in srgb, var(--nema-primary) 24%, #fff 76%);
}

.nema-submit:hover {
  background: var(--nema-primary-hover);
}

.nema-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.nema-refine-less-tight:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.nema-retry {
  color: var(--nema-text);
  background: #e9f1f0;
}

.nema-close-action {
  color: var(--nema-text);
  background: #fff;
  border: 1px solid var(--nema-border);
}

.nema-submit:active,
.nema-refine-less-tight:active,
.nema-retry:active,
.nema-close-action:active {
  transform: translateY(1px);
}

.nema-close:focus-visible,
.nema-submit:focus-visible,
.nema-refine-less-tight:focus-visible,
.nema-retry:focus-visible,
.nema-close-action:focus-visible,
.nema-file-trigger:focus-visible,
.nema-fullscreen:focus-visible,
.nema-view-button:focus-visible,
.nema-fit-adjustment-input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--nema-accent) 72%, #fff 28%);
  outline-offset: 2px;
}

@media (max-width: 860px) {
  .nema-modal {
    padding: 2vh 0;
  }

  .nema-modal-card {
    width: min(94vw, 700px);
    max-height: calc(100vh - 4vh);
    max-height: calc(100dvh - 4vh);
  }
}

@media (max-width: 640px) {
  .nema-modal {
    padding: 0;
    align-items: flex-end;
  }

  .nema-modal-card {
    width: 100vw;
    margin: 6px 0 0;
    border-radius: 18px 18px 0 0;
    max-height: calc(100vh - 6px);
    max-height: calc(100dvh - 6px);
    padding: 18px 14px 12px;
    animation: nema-sheet-enter 180ms ease forwards;
  }

  @keyframes nema-sheet-enter {
    from {
      transform: translateY(16px);
      opacity: 0;
    }

    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  .nema-stepper {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nema-step {
    justify-content: center;
    padding: 6px;
    min-height: 34px;
  }

  .nema-step span:last-child {
    display: none;
  }

  .nema-result-canvas {
    min-height: min(48vh, 420px);
  }

  .nema-result-image,
  .nema-original-result {
    height: min(48vh, 420px);
  }

  .nema-actions {
    grid-template-columns: 1fr;
    bottom: -12px;
  }
}
