/* Kunde-AI for Troll Vindufabrikk.
   Fargene og toppen er skrevet om fra vinduerogdorer (data/theme.css og
   data/style_header_footer.css, 26.10.2026). Prototypen lenker ikke til deres filer. */

:root {
  --brand: #525942;
  --brand-strong: #3f4633;
  --accent: #ffdd67;
  --hero-accent: #facc15;
  --focus-ring: rgba(82, 89, 66, .22);
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --border: #e5e7eb;
  --muted: #6b7280;
  --text: #434244;
  --radius: 8px;
  --max-width: 1100px;
  --gutter: clamp(16px, 4vw, 32px);
  --site-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-y: scroll;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--site-font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px var(--gutter) 48px;
}

/* --- Toppen: bakgrunnsbilde, logo og slagord, som på vinduerogdorer ------- */

.site-header {
  position: relative;
  height: clamp(168px, 22vh, 230px);
  background: url("img/body_bg.jpg") center / cover no-repeat;
  border-bottom: 1px solid var(--border);
}

.site-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .18), rgba(0, 0, 0, .08), rgba(0, 0, 0, .22));
  pointer-events: none;
}

.site-header-inner {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 16px var(--gutter);
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand-logo {
  display: block;
  width: clamp(94px, 9vw, 122px);
  height: auto;
}

.header-tagline {
  flex: 1;
  margin: 0;
  color: #fff;
  font-size: clamp(1.08rem, 1.85vw, 1.42rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: .2px;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .45);
}

.header-tagline .hero-accent {
  color: var(--hero-accent);
}

@media (max-width: 768px) {
  .site-header {
    height: clamp(66px, 10vh, 78px);
  }

  .site-header-inner {
    padding: 12px 16px;
    gap: 12px;
  }

  .brand-logo {
    width: 62px;
  }

  .header-tagline {
    font-size: clamp(.68rem, 2.65vw, .82rem);
    line-height: 1.15;
    text-wrap: balance;
  }

  .page {
    padding: 16px 16px 40px;
  }
}

/* =========================================================================
   Kundens flyt. Mobil først (vinduerogdorer bruker 390 px som mobilbredde).
   ========================================================================= */

:root {
  --attention: #f0c94a;
  --attention-bg: #fffaeb;
  --error: #b42318;
}

/* hidden skal skjule, også når en klasse setter display (som .loading). */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.flow {
  max-width: 760px;
}

h1,
h2 {
  margin: 8px 0 6px;
  color: var(--brand-strong);
  line-height: 1.2;
}

h1 { font-size: clamp(1.5rem, 4vw, 2rem); }
h2 { font-size: clamp(1.3rem, 3.4vw, 1.65rem); }

h1:focus,
h2:focus { outline: none; }

.lead {
  margin: 0 0 18px;
  font-size: 1.05rem;
}

.help,
.fine {
  margin: 8px 0 0;
  font-size: .88rem;
  color: var(--muted);
}

.muted { color: var(--muted); }

a { color: var(--brand); }

.error {
  margin: 10px 0 0;
  color: var(--error);
  font-weight: 600;
}

.notice {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

/* --- Knapper (som .btn på vinduerogdorer) ------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: .98rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { filter: brightness(.96); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #111827;
}

.btn-secondary {
  background: #eef0f2;
  border-color: #d1d5db;
  color: #111827;
}

.btn-small {
  min-height: 40px;
  padding: 8px 20px;
  font-size: .92rem;
}

.btn:disabled {
  background: #eef0f2;
  border-color: #d1d5db;
  color: var(--muted);
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.btn.is-waiting {
  background: #eef0f2;
  border-color: #d1d5db;
  color: var(--muted);
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

body.is-busy { cursor: progress; }
body.is-busy button { pointer-events: none; }

/* --- Prototypelinja: AI eller demo -------------------------------------------- */

.proto-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 12px;
  margin: -8px 0 14px;
  font-size: .8rem;
  color: var(--muted);
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mode-switch button {
  padding: 3px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
}

.mode-switch button[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.mode-switch button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* --- Steglinja ----------------------------------------------------------------- */

.steps ol {
  display: flex;
  gap: 6px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.steps li {
  flex: 1;
  min-width: 0;
}

.steps li > button,
.steps li > span {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 0 6px;
  border: 0;
  border-bottom: 3px solid var(--border);
  background: none;
  color: var(--muted);
  font-size: .85rem;
  text-align: left;
}

.steps li > button { cursor: pointer; }

.steps .step-no {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text);
  font-size: .75rem;
  font-weight: 700;
}

.steps .is-done > * { border-bottom-color: var(--brand); color: var(--brand); }
.steps .is-done .step-no { background: var(--brand); color: #fff; }
.steps .is-current > * { border-bottom-color: var(--accent); color: var(--text); font-weight: 700; }
.steps .is-current .step-no { background: var(--accent); }

/* --- Steg 1 ---------------------------------------------------------------------- */

textarea,
input[type="text"],
input[type="email"],
input[type="tel"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cfd4da;
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 1rem;
}

#beskrivelse {
  min-height: 140px;
  font-size: 1.05rem;
  resize: vertical;
}

.examples {
  margin-top: 16px;
}

.examples-label {
  display: block;
  margin-bottom: 6px;
  font-size: .9rem;
  color: var(--muted);
}

.examples-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.example {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: .9rem;
  cursor: pointer;
}

.example:hover { border-color: var(--brand); }

.alt { margin-top: 18px; }

/* --- Steg 2: laster, kort og spørsmål ----------------------------------------------- */

.loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 48px 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.loading { flex-wrap: wrap; }

.loading-more {
  flex-basis: 100%;
  padding-left: 38px;
  font-size: .92rem;
  font-weight: 400;
  color: var(--muted);
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.demo-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: #eef0f2;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
}

.lines {
  display: grid;
  gap: 14px;
}

.line-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.line-card.needs-answer {
  border: 2px solid var(--attention);
}

.line-main {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 14px;
  padding: 14px;
}

.line-img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
}

.line-body { min-width: 0; }

.line-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.line-no {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.line-remove {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: .85rem;
  text-decoration: underline;
  cursor: pointer;
}

.line-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .55;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: .88rem;
  cursor: pointer;
}

.chip:hover,
.line-name:hover { color: var(--brand); }
.chip:hover { border-color: var(--brand); }

.qty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
}

.qty-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.qty-btn:disabled { opacity: .4; cursor: default; }

.qty-value {
  min-width: 52px;
  text-align: center;
  font-weight: 600;
}

.source {
  margin: 10px 0 0;
  font-size: .8rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.question {
  padding: 14px;
  border-top: 1px solid var(--attention);
  background: var(--attention-bg);
}

.question:focus { outline: none; }

.question.is-editing {
  border-top-color: var(--border);
  background: var(--surface-muted);
}

.q-count {
  margin: 0 0 2px;
  font-size: .78rem;
  color: var(--muted);
}

.q-text {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
}

.q-help {
  margin: 2px 0 0;
  font-size: .88rem;
  color: var(--muted);
}

.choice-wrap { margin-top: 12px; }

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

.choice {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 8px 8px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.choice img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  margin-bottom: 4px;
}

.choice:hover { border-color: var(--brand); }

.choice.is-selected,
.choice-plain.is-selected {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.choice-label {
  font-weight: 700;
  font-size: .95rem;
}

.choice-hint {
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.35;
}

.choices-plain {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.choice-plain {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.choice-plain:hover { border-color: var(--brand); }

.confirm {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.size-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.size-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 6px;
}

.size-field label {
  grid-column: 1 / -1;
  font-size: .85rem;
  font-weight: 600;
}

.size-field input {
  width: 96px;
  font-size: 1.05rem;
}

.times {
  padding-bottom: 12px;
  color: var(--muted);
}

.cancel {
  display: inline-block;
  margin-top: 12px;
}

/* «+ Legg til vindu» */

#legg-til { margin-top: 14px; }

.add-panel {
  padding: 14px;
  border: 1px dashed #c4c9cf;
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.add-panel > .link { margin-top: 12px; }

.add-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.add-text {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.add-text .btn { justify-self: start; }

/* Det selgeren tar med */

.extras {
  margin-top: 18px;
  padding: 12px 16px;
  border-left: 4px solid var(--brand);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface-muted);
}

.extras-title {
  margin: 0 0 4px;
  font-weight: 700;
}

.extras ul {
  margin: 0;
  padding-left: 18px;
}

/* --- Steg 3: Veiledende pris --------------------------------------------------------- */

.price-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.price-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 4px 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.price-row img {
  grid-row: span 2;
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.price-desc,
.price-sum {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: .92rem;
}

.price-sum {
  grid-column: 2;
  flex-direction: row;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.price-sum strong { font-size: 1.02rem; }

.note {
  font-size: .82rem;
  color: var(--brand);
  font-weight: 600;
}

.price-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px;
  background: var(--surface-muted);
  font-weight: 600;
}

.price-total strong { font-size: 1.3rem; color: var(--brand-strong); }

/* --- Steg 4 og 5 ---------------------------------------------------------------------- */

.contact-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.field label {
  font-size: .9rem;
  font-weight: 600;
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

.field-row {
  display: grid;
  gap: 14px;
}

.field-row-post {
  grid-template-columns: 120px 1fr;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .92rem;
}

.consent input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex: 0 0 auto;
}

.receipt {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.receipt-title {
  margin: 0 0 4px;
  font-weight: 700;
}

.receipt ul {
  margin: 0 0 10px;
  padding-left: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: #1f2937;
  color: #fff;
  font-size: .92rem;
  transform: translateX(-50%);
}

/* --- Smal skjerm: valgene som en liste med lite bilde, så kunden slipper å scrolle -------- */

@media (max-width: 559px) {
  .line-main {
    grid-template-columns: 64px 1fr;
    gap: 12px;
  }

  .line-img {
    width: 64px;
    height: 64px;
  }

  .choices {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .choice {
    display: grid;
    grid-template-columns: 64px 1fr;
    column-gap: 12px;
    align-items: center;
    padding: 8px 12px 8px 8px;
  }

  .choice img {
    grid-row: span 2;
    width: 64px;
    margin: 0;
  }

  .choice-label { align-self: end; }
  .choice-hint { align-self: start; }
}

/* --- Bredere skjerm --------------------------------------------------------------------- */

@media (min-width: 560px) {
  .choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row-post { grid-template-columns: 140px 1fr; }
  .line-main { grid-template-columns: 110px 1fr; }
  .line-img { width: 110px; height: 110px; }
  .price-row { grid-template-columns: 64px 1fr auto; align-items: center; }
  .price-row img { grid-row: auto; width: 64px; height: 64px; }
  .price-sum { grid-column: auto; flex-direction: column; align-items: flex-end; gap: 0; }
}

@media (min-width: 720px) {
  .choices:has(> :nth-child(5)) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
