/* ------------------------------------------------------------------ */
/*  Linkframe — URL to QR code                                         */
/* ------------------------------------------------------------------ */

:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --ink: #16192b;
  --ink-soft: #565d78;
  --ink-faint: #9aa0b5;
  --accent: #3d43c4;
  --accent-hover: #3238ad;
  --accent-soft: #ecedfb;
  --line: #e2e4ee;
  --line-strong: #cdd0e0;
  --error: #c0384b;
  --error-soft: #fcf0f2;
  --radius: 14px;
  --shadow-card:
    0 1px 2px rgba(22, 25, 43, 0.05),
    0 8px 24px rgba(22, 25, 43, 0.07),
    0 24px 64px rgba(22, 25, 43, 0.06);
  --font:
    "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  height: 100%;
}

body {
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(61, 67, 196, 0.09), transparent 60%),
    radial-gradient(900px 480px at -10% 110%, rgba(61, 67, 196, 0.07), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
}

.shell {
  width: 100%;
  max-width: 920px;
  padding: 48px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ------------------------------------------------------------------ */
/*  Header                                                             */
/* ------------------------------------------------------------------ */

.header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(61, 67, 196, 0.35);
}

.logo-mark svg {
  width: 19px;
  height: 19px;
}

.logo-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ------------------------------------------------------------------ */
/*  Card                                                               */
/* ------------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  overflow: hidden;
}

.card-controls {
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.card-subtitle {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.55;
  max-width: 42ch;
}

/* --- form ---------------------------------------------------------- */

#qr-form {
  margin-top: 28px;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.input-row {
  display: flex;
  gap: 10px;
}

.input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  color: var(--ink-faint);
  pointer-events: none;
}

.input-icon svg {
  width: 17px;
  height: 17px;
}

#url-input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 40px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#url-input::placeholder {
  color: var(--ink-faint);
}

#url-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-wrap.is-invalid #url-input {
  border-color: var(--error);
  box-shadow: 0 0 0 3px var(--error-soft);
  animation: shake 0.3s ease;
}

.input-wrap.is-invalid .input-icon {
  color: var(--error);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

.field-error {
  margin-top: 8px;
  font-size: 0.84rem;
  color: var(--error);
}

/* --- buttons ------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease,
              box-shadow 0.15s ease, transform 0.1s ease;
}

.btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(22, 25, 43, 0.2);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* --- feature list -------------------------------------------------- */

.feature-list {
  list-style: none;
  margin-top: auto;
  padding-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.feature-list svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--accent);
}

/* ------------------------------------------------------------------ */
/*  Preview panel                                                      */
/* ------------------------------------------------------------------ */

.card-preview {
  padding: 40px 36px;
  background: linear-gradient(180deg, #fafbfe 0%, #f4f5fb 100%);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.preview-frame {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-empty {
  width: 100%;
  height: 100%;
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--ink-faint);
  text-align: center;
  padding: 20px;
}

.preview-empty svg {
  width: 44px;
  height: 44px;
  opacity: 0.55;
}

.preview-empty p {
  font-size: 0.86rem;
}

.preview-result {
  width: 100%;
  height: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(22, 25, 43, 0.08);
  padding: 14px;
  animation: fade-in 0.35s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

#qr-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.preview-caption {
  max-width: 280px;
  width: 100%;
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#download-btn {
  width: 100%;
  max-width: 280px;
}

/* ------------------------------------------------------------------ */
/*  Footer                                                             */
/* ------------------------------------------------------------------ */

.footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-faint);
}

/* ------------------------------------------------------------------ */
/*  Responsive                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 720px) {
  .shell {
    padding: 32px 16px 24px;
    gap: 22px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

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

  .card-controls,
  .card-preview {
    padding: 28px 22px;
  }

  .card-preview {
    border-left: none;
    border-top: 1px solid var(--line);
  }

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

  .feature-list {
    padding-top: 26px;
  }
}
