:root {
  --bg: #f4f8fc;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-strong: #ffffff;
  --ink: #123d71;
  --ink-soft: #4c6788;
  --line: rgba(18, 61, 113, 0.12);
  --accent: #0f4ea6;
  --accent-strong: #0a3d87;
  --shadow: 0 24px 60px rgba(16, 58, 102, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Cairo", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 78, 166, 0.15), transparent 28%),
    radial-gradient(circle at bottom right, rgba(15, 78, 166, 0.1), transparent 26%),
    linear-gradient(180deg, #f7fbff 0%, #edf4fb 100%);
  color: var(--ink);
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.site-shell {
  position: relative;
  overflow: hidden;
}

.site-shell::before,
.site-shell::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: -1;
}

.site-shell::before {
  top: -8rem;
  right: -5rem;
  width: 19rem;
  height: 19rem;
  border-radius: 50%;
  border: 28px solid rgba(15, 78, 166, 0.06);
}

.site-shell::after {
  bottom: -10rem;
  left: -3rem;
  width: 24rem;
  height: 24rem;
  border-radius: 43% 57% 58% 42% / 43% 46% 54% 57%;
  background: radial-gradient(circle at center, rgba(15, 78, 166, 0.12), rgba(15, 78, 166, 0.02));
  filter: blur(12px);
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero {
  position: relative;
  padding: 5rem 0 4rem;
}

.hero__backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(10, 61, 135, 0.94), rgba(15, 78, 166, 0.84)),
    linear-gradient(45deg, rgba(255, 255, 255, 0.1), transparent 52%);
  clip-path: ellipse(120% 100% at 50% 0%);
}

.hero__content {
  position: relative;
  color: #fff;
}

.hero__eyebrow,
.section-head__tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.92rem;
  font-weight: 700;
}

.hero__title {
  margin: 1rem 0 0.8rem;
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1.2;
}

.hero__subtitle {
  margin: -0.2rem 0 1rem;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(1.2rem, 3.2vw, 2rem);
  font-weight: 800;
  line-height: 1.5;
}

.hero__copy {
  max-width: 42rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.05rem;
  line-height: 1.9;
}

.cards-section {
  padding: 2rem 0 4rem;
}

.site-footer {
  padding: 0 0 2rem;
}

.site-footer .container {
  padding: 1rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 36px rgba(16, 58, 102, 0.08);
}

.site-footer p {
  margin: 0;
  color: var(--ink-soft);
  text-align: center;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.9;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.section-head h2 {
  margin: 0.8rem 0 0;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.section-head__text {
  max-width: 32rem;
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.9;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.template-card,
.editor__panel,
.preview-card {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.template-card {
  overflow: hidden;
}

.template-card__media {
  position: relative;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(15, 78, 166, 0.07), rgba(15, 78, 166, 0.02));
}

.template-card__stamp {
  position: absolute;
  right: 4.25rem;
  bottom: 2.55rem;
  z-index: 2;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.template-card__stamp--blue {
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 3px 10px rgba(10, 33, 74, 0.3);
}

.template-card__stamp--light {
  color: #2c5f93;
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.78);
}

.template-card__media img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 22px;
  background: #dfeaf7;
}

.template-card__body {
  padding: 1.3rem 1.3rem 1.5rem;
}

.template-card__body h3,
.preview-card__head h3,
.editor__panel h2 {
  margin: 0;
  font-size: 1.35rem;
}

.template-card__body p,
.editor__description {
  margin: 0.85rem 0 1.3rem;
  color: var(--ink-soft);
  line-height: 1.9;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.9rem 1.3rem;
  border: 1px solid transparent;
  border-radius: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 14px 30px rgba(15, 78, 166, 0.24);
}

.button--ghost {
  background: rgba(255, 255, 255, 0.74);
  border-color: var(--line);
  color: var(--ink);
}

.subhero {
  padding: 1.5rem 0 0;
}

.subhero__inner {
  padding: 1.2rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
}

.subhero__inner h1 {
  margin: 0.9rem 0 0;
  font-size: clamp(1.5rem, 3vw, 2.3rem);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.breadcrumb a {
  color: var(--accent);
}

.editor {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.6rem 0 4rem;
}

.editor__panel,
.preview-card {
  padding: 1.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 1rem;
  color: var(--accent);
  font-weight: 700;
}

.field {
  display: grid;
  gap: 0.6rem;
}

.field span {
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 3.45rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(18, 61, 113, 0.18);
  border-radius: 16px;
  outline: none;
  background: rgba(255, 255, 255, 0.9);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input:focus {
  border-color: rgba(15, 78, 166, 0.54);
  box-shadow: 0 0 0 4px rgba(15, 78, 166, 0.12);
}

.editor__actions {
  display: flex;
  gap: 0.9rem;
  margin-top: 1.2rem;
}

.editor__actions .button {
  flex: 1;
}

.status-message {
  min-height: 1.7rem;
  margin: 0.9rem 0 0;
  color: var(--ink-soft);
}

.preview-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.template-badge {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(15, 78, 166, 0.1);
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 800;
}

.preview-stage {
  display: grid;
  place-items: center;
  min-height: 70vh;
  padding: 1rem;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(15, 78, 166, 0.06), rgba(15, 78, 166, 0.01)),
    repeating-linear-gradient(45deg, rgba(15, 78, 166, 0.03) 0, rgba(15, 78, 166, 0.03) 10px, transparent 10px, transparent 20px);
}

#cardCanvas {
  width: min(100%, 430px);
  height: auto;
  border-radius: 26px;
  box-shadow: 0 24px 60px rgba(9, 44, 96, 0.22);
  background: #fff;
}

@media (max-width: 920px) {
  .card-grid,
  .editor {
    grid-template-columns: 1fr;
  }

  .editor {
    gap: 1rem;
  }

  .section-head,
  .preview-card__head,
  .editor__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero {
    padding-top: 4rem;
  }
}

@media (max-width: 640px) {
  .container {
    width: min(100% - 1rem, 100%);
  }

  .site-shell::before {
    top: -5rem;
    right: -4rem;
    width: 12rem;
    height: 12rem;
    border-width: 18px;
  }

  .site-shell::after {
    bottom: -7rem;
    left: -2rem;
    width: 16rem;
    height: 16rem;
  }

  .hero,
  .cards-section,
  .editor {
    padding-bottom: 2.5rem;
  }

  .hero {
    padding-top: 3.2rem;
  }

  .hero__backdrop {
    clip-path: ellipse(160% 100% at 50% 0%);
  }

  .hero__title {
    margin-bottom: 0.65rem;
    font-size: 1.8rem;
  }

  .hero__subtitle {
    margin-bottom: 0.8rem;
    font-size: 1.05rem;
  }

  .hero__copy {
    font-size: 0.97rem;
    line-height: 1.75;
  }

  .cards-section {
    padding-top: 1.2rem;
  }

  .section-head {
    margin-bottom: 1rem;
  }

  .card-grid {
    gap: 1rem;
  }

  .template-card__media {
    padding: 0.75rem;
  }

  .template-card__stamp {
    right: 3.35rem;
    bottom: 2rem;
    font-size: 0.8rem;
  }

  .template-card__body {
    padding: 1rem 1rem 1.15rem;
  }

  .template-card__body h3,
  .preview-card__head h3,
  .editor__panel h2 {
    font-size: 1.18rem;
  }

  .template-card__body .button {
    width: 100%;
  }

  .template-card,
  .editor__panel,
  .preview-card,
  .subhero__inner {
    border-radius: 22px;
  }

  .subhero {
    padding-top: 0.9rem;
  }

  .subhero__inner {
    padding: 1rem;
  }

  .subhero__inner h1 {
    font-size: 1.35rem;
    line-height: 1.4;
  }

  .breadcrumb {
    flex-wrap: wrap;
    row-gap: 0.2rem;
    font-size: 0.88rem;
  }

  .editor {
    gap: 0.9rem;
    padding-top: 1rem;
  }

  .editor__panel,
  .preview-card {
    padding: 1rem;
  }

  .editor__description {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.7;
  }

  .field input,
  .button {
    min-height: 3.1rem;
  }

  .editor__actions {
    gap: 0.7rem;
    margin-top: 1rem;
  }

  .preview-card__head {
    margin-bottom: 0.8rem;
  }

  .template-badge {
    align-self: flex-start;
  }

  .preview-stage {
    min-height: auto;
    padding: 0.65rem;
    border-radius: 18px;
  }

  #cardCanvas {
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 18px 40px rgba(9, 44, 96, 0.18);
  }

  .site-footer {
    padding-bottom: 1rem;
  }

  .site-footer .container {
    padding: 0.85rem 1rem;
    border-radius: 18px;
  }

  .site-footer p {
    font-size: 0.86rem;
    line-height: 1.75;
  }
}

@media (max-width: 420px) {
  .container {
    width: min(100% - 0.75rem, 100%);
  }

  .hero {
    padding-top: 2.8rem;
    padding-bottom: 2rem;
  }

  .hero__eyebrow,
  .section-head__tag {
    font-size: 0.82rem;
    padding: 0.38rem 0.75rem;
  }

  .hero__title {
    font-size: 1.6rem;
  }

  .hero__subtitle {
    font-size: 0.98rem;
  }

  .template-card__stamp {
    right: 2.85rem;
    bottom: 1.8rem;
    font-size: 0.74rem;
  }

  .editor__actions .button {
    width: 100%;
  }

  .status-message {
    font-size: 0.92rem;
  }
}