:root {
  --primary: #d0db28;
  --secondary: #014252;
  --surface: #fcfcfc;
  --footer: #7b5aa6;
  --text-dark: #ffffff;
  --text-light: #014252;
  --muted: #666666;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #ffffff;
  color: var(--text-light);
  font-family: "Alexandria", "Tajawal", system-ui, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  min-height: 150px;
  display: grid;
  place-items: center;
  background: var(--secondary);
  padding: 24px;
}

.topbar img {
  width: min(230px, 58vw);
  height: auto;
  max-height: 92px;
  object-fit: contain;
}

main {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px 18px 0;
}

.kicker {
  margin: 0 0 12px;
  text-align: center;
  font-weight: 800;
  color: var(--secondary);
}

.designer {
  min-height: 600px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 42px 22px 36px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.progress {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.progress span {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: #e8e8e8;
}

.progress span.active {
  background: var(--primary);
}

.step {
  flex: 1;
  animation: slideIn 220ms ease both;
}

.step-header {
  text-align: center;
  margin-bottom: 28px;
}

.step-header h1 {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.35;
}

.step-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.option {
  min-height: 128px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #f8f8f8;
  color: #333;
  cursor: pointer;
  text-align: center;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.option:hover {
  transform: translateY(-1px);
}

.option.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, white);
}

.option svg {
  width: 42px;
  height: 42px;
  stroke: currentColor;
}

.option strong {
  font-size: 18px;
}

.option small {
  color: var(--muted);
  line-height: 1.7;
}

.template-preview {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--text-dark);
}

.template-preview.light {
  color: var(--text-light);
}

.template-preview.portrait {
  aspect-ratio: 9 / 16;
}

.template-preview span {
  width: 70%;
  text-align: center;
  font-weight: 800;
  font-size: 24px;
  line-height: 1.5;
}

.gallery-grid .option {
  min-height: 188px;
}

.calligraphy-choice-preview {
  width: 100%;
  min-height: 92px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
  overflow: hidden;
}

.calligraphy-choice-preview img {
  width: 86%;
  height: 86%;
  object-fit: contain;
}

.calligraphy-choice-preview span {
  color: var(--primary);
  font-size: clamp(28px, 6vw, 42px);
  font-weight: 800;
  line-height: 1.2;
}

.calligraphy {
  font-family: "Tajawal", "Alexandria", sans-serif;
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 800;
}

.calligraphy.style-2 {
  font-family: "Alexandria", sans-serif;
  letter-spacing: 0;
}

.calligraphy.style-3 {
  transform: skewX(-8deg);
}

.choices {
  display: grid;
  gap: 10px;
}

.message-option {
  min-height: auto;
  justify-items: start;
  text-align: right;
  line-height: 1.8;
}

textarea,
input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"] {
  width: 100%;
  border: 2px solid #ececec;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  color: #222;
  text-align: center;
  outline: none;
}

textarea {
  min-height: 130px;
  resize: vertical;
  text-align: right;
}

textarea:focus,
input:focus {
  border-color: var(--primary);
}

.nav-row {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.btn {
  min-height: 58px;
  border: 0;
  border-radius: 999px;
  padding: 14px 28px;
  cursor: pointer;
  font-weight: 800;
}

.btn-primary {
  flex: 1;
  background: var(--primary);
  color: #fff;
}

.btn-secondary {
  flex: 1;
  background: #eeeeee;
  color: #333;
}

.btn-dark {
  background: #222;
  color: #fff;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.result-img {
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
  background: #fff;
}

.result-actions {
  display: grid;
  gap: 10px;
}

.footer {
  min-height: 196px;
  margin-top: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  background: var(--footer);
  color: #fff;
  text-align: center;
  padding: 28px;
}

.footer a {
  color: #fff;
  text-decoration: none;
  font-size: clamp(28px, 6vw, 42px);
  font-weight: 400;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-18px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 620px) {
  .topbar {
    min-height: 136px;
  }

  main {
    padding: 14px 0 0;
  }

  .designer {
    min-height: 620px;
    border-radius: 0;
    padding: 34px 16px 30px;
    box-shadow: none;
  }

  .grid-two {
    grid-template-columns: 1fr;
  }

  .nav-row {
    flex-direction: column;
  }
}
