/* ==========================================================================
   Design tokens · iLovePDF Clean Utility
   ========================================================================== */
:root {
  /* colors */
  --primary: #e5322d;
  --primary-hover: #cf2a26;
  --primary-contrast: #ffffff;
  --secondary: #33333b;
  --tertiary: #e5e7eb;
  --neutral: #f5f5fa;
  --surface: #ffffff;
  --on-surface: #33333b;
  --muted-text: #6b6b76;
  --border: #e5e7eb;
  --background: #f5f5fa;
  --error: #d93b30;

  /* radius */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-full: 9999px;

  /* spacing */
  --s-xs: 6px;
  --s-sm: 8px;
  --s-md: 16px;
  --s-lg: 32px;
  --s-xl: 56px;
  --s-xxl: 64px;

  --font: "Graphik", Arial, "Helvetica Neue", Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 22px;
  letter-spacing: 0.2px;
  color: var(--on-surface);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Top navigation
   ========================================================================== */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav__inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 var(--s-md);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-sm);
  text-decoration: none;
  color: var(--on-surface);
}
.brand__mark {
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  background: var(--primary);
  position: relative;
}
.brand__mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--primary-contrast);
  transform: translateX(-50%);
  opacity: 0.9;
}
.brand__name { font-size: 18px; font-weight: 600; letter-spacing: 0; }
.brand__accent { color: var(--primary); }

.nav__links { display: flex; gap: var(--s-lg); }
.nav-link {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--on-surface);
  text-decoration: none;
}
.nav-link:hover { color: var(--primary); }

/* ==========================================================================
   Layout
   ========================================================================== */
.app { max-width: 1040px; margin: 0 auto; padding: 0 var(--s-md) var(--s-xxl); }

.hero { text-align: center; padding: var(--s-xl) 0 var(--s-lg); }
.hero__title {
  margin: 0 0 var(--s-sm);
  font-size: 42px;
  font-weight: 600;
  line-height: 52px;
  letter-spacing: 0;
}
.hero__sub {
  margin: 0 auto;
  max-width: 560px;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.3px;
  color: var(--muted-text);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--s-md);
  align-items: start;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-md);
}
.card__title {
  margin: 0 0 var(--s-md);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  letter-spacing: 0;
  color: var(--muted-text);
  text-transform: uppercase;
}

.controls { display: flex; flex-direction: column; gap: var(--s-md); }

/* ==========================================================================
   Fields, inputs
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: var(--s-xs); }
.field__label {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--on-surface);
}
.field__hint { font-weight: 400; color: var(--muted-text); }

textarea, select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--on-surface);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font: inherit;
  font-size: 14px;
  line-height: 20px;
}
textarea { resize: vertical; min-height: 44px; }
textarea:focus, select:focus,
.file:focus-within {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 50, 45, 0.12);
}

/* custom file field */
.file {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 8px 6px 6px;
  cursor: pointer;
}
.file__btn {
  flex: 0 0 auto;
  background: var(--neutral);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
}
.file:hover .file__btn { border-color: var(--primary); color: var(--primary); }
.file__name {
  font-size: 14px;
  color: var(--muted-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file--set .file__name { color: var(--on-surface); }

/* images row — two drop zones side by side */
.images-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-sm);
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-md);
  padding: var(--s-md) var(--s-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 3px;
  cursor: pointer;
  background: var(--neutral);
  transition: border-color .15s ease, background .15s ease;
}
.drop-zone:hover,
.drop-zone.is-over {
  border-color: var(--primary);
  background: rgba(229, 50, 45, 0.04);
}
.drop-zone.is-set {
  border-style: solid;
  border-color: var(--primary);
}
.drop-zone__icon {
  color: var(--muted-text);
  margin-bottom: 2px;
  flex-shrink: 0;
}
.drop-zone.is-set .drop-zone__icon { color: var(--primary); }
.drop-zone__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface);
  margin: 0;
}
.drop-zone__hint {
  font-size: 11px;
  color: var(--muted-text);
  margin: 0;
}
.drop-zone__cta {
  font-size: 12px;
  color: var(--muted-text);
  margin: 4px 0 0;
}
.drop-zone__pick {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}
.drop-zone__name {
  font-size: 11px;
  font-weight: 600;
  color: var(--on-surface);
  margin: 4px 0 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drop-zone__name:empty { display: none; }

/* checkbox */
.check {
  display: flex;
  align-items: center;
  gap: var(--s-sm);
  font-size: 14px;
  color: var(--on-surface);
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}
.file.is-disabled {
  opacity: .5;
  pointer-events: none;
}

.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted-text);
  border-bottom: 2px solid var(--muted-text);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
select { appearance: none; -webkit-appearance: none; padding-right: 32px; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.actions { display: flex; gap: var(--s-sm); }
.btn {
  appearance: none;
  height: 40px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  letter-spacing: 0;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease;
}
.btn--primary {
  background: var(--primary);
  color: var(--primary-contrast);
  border-color: var(--primary);
  flex: 1;
}
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--secondary {
  background: transparent;
  color: var(--on-surface);
  border-color: var(--border);
}
.btn--secondary:hover:not(:disabled) { border-color: var(--secondary); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ==========================================================================
   Status & result
   ========================================================================== */
.status {
  font-size: 14px;
  line-height: 20px;
  color: var(--muted-text);
  margin: 0;
  min-height: 20px;
}

.result { display: flex; flex-direction: column; gap: var(--s-md); margin: 0; }
.result[hidden] { display: none; }
.result__divider { height: 1px; background: var(--border); }
.result video { width: 100%; border-radius: var(--r-md); background: #000; display: block; }

/* ==========================================================================
   Preview stage
   ========================================================================== */
.preview { position: sticky; top: 88px; }
.stage {
  display: flex;
  justify-content: center;
  background: var(--neutral);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-md);
}
#canvas {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 9 / 16;
  height: auto;
  border-radius: var(--r-md);
  background: #000;
  display: block;
}
.preview__note {
  margin: var(--s-sm) 0 0;
  text-align: center;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.2px;
  color: var(--muted-text);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
  #canvas { max-width: 220px; }
  .hero { padding: var(--s-lg) 0 var(--s-md); }
  .hero__title { font-size: 33px; line-height: 40px; }
  .nav__links { display: none; }
}
