/* ============================================================
   Nordic Software Pulse — 320x320 interactive ad/survey
   Premium, modern business look. Self-contained, no @imports.
   ============================================================ */

:root {
  --w: 320px;
  --h: 320px;

  /* Palette — Nordic ink + cobalt accent */
  --ink:        #0e1726;
  --ink-soft:   #1b2740;
  --panel:      #ffffff;
  --line:       #e4e8f0;
  --text:       #11203a;
  --muted:      #5e6b85;
  --accent:     #2563eb;
  --accent-700: #1d4ed8;
  --accent-50:  #eef3ff;
  --ok:         #16a34a;
  --err:        #dc2626;

  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 6px 22px rgba(14, 23, 38, 0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Center the ad if the iframe/viewport is larger than 320x320 */
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ---------- The ad shell — locked to 320x320 ---------- */
.ad {
  position: relative;
  width: var(--w);
  height: var(--h);
  min-width: var(--w);
  min-height: var(--h);
  max-width: var(--w);
  max-height: var(--h);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  color: var(--text);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Header ---------- */
.ad__header {
  flex: 0 0 auto;
  padding: 11px 14px 8px;
  background: var(--ink);
  color: #fff;
  border-radius: 16px 16px 0 0;
}

.ad__brand { display: flex; align-items: center; gap: 9px; }

/* Product wordmark (Tenka Cloud), top-right of the header.
   Source SVG is light-grey, so it reads cleanly on the dark header. */
.ad__hdrlogo {
  margin-left: auto;
  height: 18px;
  width: auto;
  flex: 0 0 auto;
  opacity: 0.95;
}

.ad__logo {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #60a5fa 100%);
  border-radius: 8px;
  flex: 0 0 auto;
}

.ad__titles { line-height: 1.1; min-width: 0; }

.ad__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1px;
}

.ad__subtitle {
  margin: 2px 0 0;
  font-size: 10.5px;
  font-weight: 500;
  color: #aebbd6;
}

.ad__progress {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
}

.ad__progress-label {
  font-size: 10px;
  font-weight: 700;
  color: #cdd8f0;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.ad__progress-bar {
  flex: 1 1 auto;
  height: 4px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 99px;
  overflow: hidden;
}

.ad__progress-fill {
  display: block;
  height: 100%;
  width: 33%;
  background: linear-gradient(90deg, var(--accent) 0%, #60a5fa 100%);
  border-radius: 99px;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Body ---------- */
.ad__body {
  flex: 1 1 auto;
  position: relative;
  padding: 12px 14px 8px;
  overflow: hidden;
}

.step { height: 100%; display: none; flex-direction: column; }
.step--active { display: flex; animation: fadeIn 0.32s ease both; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step__question {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}
.step__question--sm { font-size: 13px; margin-bottom: 6px; }

.step__lead {
  margin: 0 0 10px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}

/* ---------- Choice grids ---------- */
.grid { display: grid; gap: 7px; flex: 1 1 auto; align-content: start; }

.grid--software {
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
}

.grid--priority {
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
}

.choice {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.15;
  padding: 4px 6px;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-align: center;
  transition: transform 0.08s ease, border-color 0.15s ease,
              background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
  min-height: 0;
}
.choice--wide { font-size: 12.5px; }

.choice:hover {
  border-color: #bcd0ff;
  background: var(--accent-50);
}
.choice:active { transform: scale(0.96); }

.choice:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* selected pulse feedback */
.choice--picked {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  animation: pick 0.32s ease;
}
@keyframes pick {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ---------- Lead form ---------- */
#leadForm { display: flex; flex-direction: column; gap: 9px; flex: 1 1 auto; }

.field { display: block; }

#email {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#email::placeholder { color: #9aa6bf; }
#email:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
#email.invalid { border-color: var(--err); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12); }

.consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--muted);
  cursor: pointer;
}
.consent input {
  margin: 1px 0 0;
  width: 16px; height: 16px;
  flex: 0 0 auto;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-msg {
  margin: 0;
  min-height: 13px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--err);
}
.form-msg--ok { color: var(--ok); }

.btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.30);
  margin-top: auto;
}
.btn--primary:hover { background: var(--accent-700); }
.btn--primary:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.6; cursor: progress; }

/* ---------- Success ---------- */
.step--done { display: none; }
.step--done.step--active { display: flex; }
.done {
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 6px;
}
.done__check {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  font-size: 26px; font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--ok) 0%, #4ade80 100%);
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.30);
  animation: pop 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes pop {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
.done__text {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  max-width: 230px;
}

/* ---------- Footer ---------- */
.ad__footer {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  background: #fafbfe;
  border-radius: 0 0 16px 16px;
}
.ad__powered {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--muted);
}
.ad__powered-text { line-height: 1; }
/* Parent-company mark (Tenka AB) next to "Powered by". */
.ad__powered-logo {
  display: inline-block;
  height: 16px;
  width: auto;
  border-radius: 3px;
  vertical-align: middle;
}
.ad__privacy {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.ad__privacy:hover { text-decoration: underline; }

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
