/* ==========================================================================
   MechPilot – stilmall
   Färger och typografi styrs av variablerna i :root.
   ========================================================================== */

:root {
  color-scheme: light dark;

  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eaf0ef;
  --text: #0e1b1d;
  --muted: #4a5b5e;
  --border: #d8e1e0;
  --accent: #0a5a66;
  --accent-hover: #084852;
  --accent-soft: #dcecee;
  --on-accent: #ffffff;
  --rec: #c92a2a;
  --ok: #1d7a4a;
  --focus: #0a5a66;

  --phone-frame: #0f1a1c;
  --shadow-sm: 0 1px 2px rgb(14 27 29 / .06);
  --shadow: 0 1px 2px rgb(14 27 29 / .05), 0 12px 32px -8px rgb(14 27 29 / .12);
  --shadow-lg: 0 2px 4px rgb(14 27 29 / .06), 0 32px 64px -16px rgb(14 27 29 / .28);

  --font: "Inter", "Inter var", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, monospace;

  --radius: 14px;
  --radius-sm: 10px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1315;
    --surface: #111c1f;
    --surface-2: #0f191c;
    --text: #e6eeee;
    --muted: #a0b2b4;
    --border: #23353a;
    --accent: #5fc4cd;
    --accent-hover: #86d6dd;
    --accent-soft: #14353b;
    --on-accent: #04201f;
    --rec: #ff6b6b;
    --ok: #4fd18b;
    --focus: #86d6dd;

    --phone-frame: #000;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 12px 32px -8px rgb(0 0 0 / .5);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / .3), 0 32px 64px -16px rgb(0 0 0 / .7);
  }
}

/* --- Bas ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Döljer sidan kort medan engelsk text laddas (se inline-skript i <head>). */
.i18n-pending body { opacity: 0; animation: i18n-reveal 0s 1.2s forwards; }
@keyframes i18n-reveal { to { opacity: 1; } }

h1, h2, h3 { margin: 0; line-height: 1.12; letter-spacing: -0.025em; text-wrap: balance; }
h1 { font-size: clamp(2.4rem, 6.5vw + .4rem, 4.25rem); font-weight: 750; letter-spacing: -0.035em; line-height: 1.02; }
h2 { font-size: clamp(1.85rem, 3.4vw + .6rem, 2.9rem); font-weight: 720; }
h3 { font-size: 1.2rem; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: 1160px; margin-inline: auto; padding-inline: var(--gutter); }
.narrow { max-width: 820px; }

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--on-accent); }

/* --- Knappar ------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: .7em 1.25em;
  border: 1px solid transparent; border-radius: 999px;
  font: inherit; font-weight: 620; font-size: 1rem; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .15s ease;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { color: var(--text); border-color: var(--border); background: transparent; }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }
.btn-sm { min-height: 40px; padding: .5em 1em; font-size: .9375rem; }
.btn-lg { min-height: 52px; padding: .85em 1.5em; font-size: 1.0625rem; }

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

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.header-inner { display: flex; align-items: center; gap: 16px; min-height: var(--header-h); }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; font-weight: 720; letter-spacing: -0.02em; font-size: 1.0625rem;
  margin-right: auto;
}
.brand:hover { color: var(--text); }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { stroke: var(--on-accent); stroke-width: 2.4; stroke-linecap: round; fill: none; }

.main-nav { display: none; }
.main-nav ul { display: flex; gap: 4px; }
.main-nav a {
  display: block; padding: 8px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 520; font-size: .9375rem;
}
.main-nav a:hover { color: var(--text); background: var(--surface-2); }

.header-actions { display: flex; align-items: center; gap: 10px; }

.lang-switch {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.lang-switch button {
  min-width: 40px; min-height: 34px; padding: 0 10px;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted);
  font: inherit; font-size: .8125rem; font-weight: 650; letter-spacing: .04em; cursor: pointer;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

.header-cta { display: none; }

@media (min-width: 560px) { .header-cta { display: inline-flex; } }
@media (min-width: 900px) { .main-nav { display: block; } }

/* --- Hero --------------------------------------------------------------- */

.hero { padding-block: clamp(40px, 8vw, 96px) clamp(56px, 9vw, 112px); overflow: hidden; }
.hero-grid { display: grid; gap: 56px; align-items: center; }

.eyebrow {
  display: inline-block; margin-bottom: 20px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: .875rem; font-weight: 620;
}
.hero-copy { container-type: inline-size; }
/* Svenska sammansättningar är långa – rubriken skalas efter kolumnens bredd så att inget ord sticker ut. */
.hero h1 { font-size: clamp(1.6rem, 9cqi, 4.25rem); overflow-wrap: break-word; hyphens: manual; }
.lead { margin-top: 20px; font-size: clamp(1.125rem, 1vw + .9rem, 1.3rem); color: var(--muted); max-width: 36ch; line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-note { display: flex; align-items: center; gap: 10px; margin-top: 24px; font-size: .9375rem; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); flex: none; }

@media (max-width: 479px) {
  .hero-actions .btn { width: 100%; }
}

@media (min-width: 960px) {
  .hero-grid { grid-template-columns: 1.1fr .9fr; gap: 48px; }
}

/* --- Telefon-mockup ----------------------------------------------------- */

.hero-visual { position: relative; display: flex; justify-content: center; padding-bottom: 28px; }
.hero-visual::before {
  content: ""; position: absolute; inset: 8% -10% 0; z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent);
  filter: blur(8px);
}

.phone {
  width: min(320px, 86vw);
  padding: 10px;
  border-radius: 46px;
  background: var(--phone-frame);
  box-shadow: var(--shadow-lg), inset 0 0 0 1.5px rgb(255 255 255 / .08);
}
.phone-screen {
  display: flex; flex-direction: column; gap: 14px;
  min-height: 560px;
  padding: 12px 16px 18px;
  border-radius: 37px;
  background: var(--bg);
  font-size: 13px; line-height: 1.4;
  overflow: hidden;
}
.phone-status { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 0; font-size: 12px; font-weight: 650; }
.phone-island { width: 84px; height: 24px; border-radius: 999px; background: var(--phone-frame); }
.phone-icons { width: 34px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, var(--text) 0 70%, transparent 70%); opacity: .8; }

.app-bar { display: flex; align-items: flex-end; justify-content: space-between; padding-top: 6px; }
.app-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.app-order { display: block; font-size: 22px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.app-tag { padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 650; }

.rec-card {
  padding: 14px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.rec-head { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rec); }
.rec-label { color: var(--rec); }
.rec-timer { margin-left: auto; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }

.wave { display: flex; align-items: center; gap: 3px; height: 40px; margin: 10px 0; }
.wave i {
  flex: 1; height: 30%; border-radius: 2px; background: var(--accent);
  transform-origin: center;
}
.wave i:nth-child(3n)   { height: 70%; }
.wave i:nth-child(4n+1) { height: 45%; }
.wave i:nth-child(5n+2) { height: 90%; }
.wave i:nth-child(7n)   { height: 55%; }
.rec-quote { font-size: 12.5px; color: var(--muted); font-style: italic; }

.tl-title { font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.timeline { position: relative; display: grid; gap: 10px; }
.timeline::before { content: ""; position: absolute; left: 47px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline li { position: relative; display: grid; grid-template-columns: 38px 1fr; gap: 20px; align-items: baseline; }
.timeline li::before {
  content: ""; position: absolute; left: 44px; top: 5px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.timeline li.is-live::before { background: var(--rec); border-color: var(--rec); }
.timeline time { font-family: var(--mono); font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline span { font-weight: 550; }

.app-button {
  margin-top: auto; padding: 12px; border-radius: 14px; text-align: center;
  background: var(--accent); color: var(--on-accent); font-weight: 650;
}

.toast {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px 12px 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: .875rem; line-height: 1.3; white-space: nowrap;
}
.toast-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: color-mix(in srgb, var(--ok) 16%, transparent); flex: none; }
.toast-icon svg, .success-icon svg { width: 18px; height: 18px; fill: none; stroke: var(--ok); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.toast-text { display: flex; flex-direction: column; }
.toast-text span { color: var(--muted); font-size: .8125rem; }

@media (min-width: 960px) {
  .toast { left: auto; right: -8px; bottom: 92px; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .rec-dot { animation: pulse 1.4s ease-in-out infinite; }
  .wave i { animation: wave 1.1s ease-in-out infinite; }
  .wave i:nth-child(2n) { animation-delay: -.3s; }
  .wave i:nth-child(3n) { animation-delay: -.6s; animation-duration: 1.3s; }
  .wave i:nth-child(5n) { animation-delay: -.9s; animation-duration: .9s; }
  .timeline li.is-live::before { animation: pulse 1.4s ease-in-out infinite; }
  .toast { animation: toast-in .6s 1s cubic-bezier(.2,.8,.2,1) both; }
}
@keyframes pulse { 50% { opacity: .35; } }
@keyframes wave { 50% { transform: scaleY(.35); } }
@keyframes toast-in { from { opacity: 0; translate: 0 12px; } }

/* --- Sektioner ---------------------------------------------------------- */

.section { padding-block: clamp(64px, 10vw, 120px); }
.section-alt { background: var(--surface-2); }
@media (prefers-color-scheme: dark) { .section-alt { background: #0e181b; } }

.section-head { max-width: 720px; margin-bottom: clamp(32px, 5vw, 56px); }
.kicker { margin-bottom: 12px; color: var(--accent); font-size: .875rem; font-weight: 680; letter-spacing: .08em; text-transform: uppercase; }

.grid-3 { display: grid; gap: 20px; }
@media (min-width: 760px) { .grid-3 { grid-template-columns: repeat(3, 1fr); gap: 24px; } }

.icon, .step-icon {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 20px;
  border-radius: 12px; background: var(--accent-soft); color: var(--accent);
}
.icon svg, .step-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Problemet */
.problem-item { padding-top: 24px; border-top: 2px solid var(--text); }
.problem-item h3 { margin-bottom: 10px; }
.problem-item p { color: var(--muted); }

/* Så funkar det */
.steps { counter-reset: step; }
.step {
  position: relative; counter-increment: step;
  padding: 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.step::after {
  content: counter(step, decimal-leading-zero);
  position: absolute; top: 24px; right: 28px;
  font-family: var(--mono); font-size: .875rem; font-weight: 600; color: var(--muted);
}
.step-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.step h3 { margin-bottom: 10px; }
.step p { color: var(--muted); }

/* För vem */
.card {
  padding: 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.card h3 { margin-bottom: 10px; }
.card p { color: var(--muted); }

/* Grundaren */
.founder { display: grid; gap: 40px; align-items: center; }
.founder-copy h2 { margin-bottom: 24px; }
.founder-copy p + p { margin-top: 16px; }
.founder-copy p:not(.kicker) { color: var(--muted); font-size: 1.125rem; max-width: 60ch; }
.founder-card { margin: 0; display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); max-width: 420px; }
.founder-photo {
  display: grid; place-items: center; flex: none;
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: .75rem; font-weight: 650;
  border: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent);
}
.founder-card figcaption { display: flex; flex-direction: column; gap: 2px; }
.founder-card figcaption span { color: var(--muted); font-size: .9375rem; line-height: 1.4; }
@media (min-width: 900px) { .founder { grid-template-columns: 1.4fr 1fr; gap: 64px; } .founder-card { justify-self: end; } }

/* Vanliga frågor */
.faq { border-top: 1px solid var(--border); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary {
  position: relative; display: block; cursor: pointer; list-style: none;
  padding: 22px 48px 22px 0; font-size: 1.125rem; font-weight: 620;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 8px; top: 50%;
  width: 10px; height: 10px; margin-top: -7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s ease;
}
.faq details[open] summary::after { transform: rotate(225deg); margin-top: -2px; }
.faq summary:hover { color: var(--accent); }
.faq details p { padding: 0 0 24px; color: var(--muted); max-width: 64ch; }

/* --- Kontakt ------------------------------------------------------------ */

.section-contact { background: var(--surface-2); }
@media (prefers-color-scheme: dark) { .section-contact { background: #0e181b; } }
.contact-grid { display: grid; gap: 40px; }
.contact-copy .lead { max-width: 44ch; }
.steps-title { margin-top: 36px; margin-bottom: 16px; font-size: 1rem; }
.next-steps { counter-reset: n; display: grid; gap: 12px; }
.next-steps li { counter-increment: n; display: grid; grid-template-columns: 28px 1fr; gap: 12px; color: var(--muted); }
.next-steps li::before {
  content: counter(n); display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: .8125rem; font-weight: 650;
}
@media (min-width: 960px) { .contact-grid { grid-template-columns: .85fr 1.15fr; gap: 64px; align-items: start; } }

.form-card {
  padding: clamp(20px, 4vw, 36px); border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.form-grid { display: grid; gap: 18px; }
@media (min-width: 620px) { .form-grid { grid-template-columns: 1fr 1fr; } .field-full { grid-column: 1 / -1; } }

.field label { display: block; margin-bottom: 6px; font-size: .9375rem; font-weight: 600; }
.req { color: var(--rec); }
.optional { color: var(--muted); font-weight: 450; }

.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text);
  font: inherit; font-size: 1rem; /* 16px förhindrar zoom i iOS */
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; min-height: 120px; }
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
}
.field input::placeholder, .field textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--muted); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.field :user-invalid { border-color: var(--rec); }

.consent { display: flex; gap: 12px; align-items: flex-start; margin-top: 22px; }
.consent input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; }
.consent label { font-size: .9375rem; cursor: pointer; }
.form-meta { margin-top: 10px; padding-left: 34px; font-size: .875rem; color: var(--muted); }

.form-error {
  margin-top: 18px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--rec) 10%, transparent); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--rec) 40%, transparent); font-size: .9375rem;
}

.btn-submit { margin-top: 24px; width: 100%; }
@media (min-width: 620px) { .btn-submit { width: auto; min-width: 180px; } }
.btn-submit .label-busy { display: none; }
.btn-submit[aria-busy="true"] { opacity: .75; cursor: progress; }
.btn-submit[aria-busy="true"] .label-idle { display: none; }
.btn-submit[aria-busy="true"] .label-busy { display: inline; }

.form-success { text-align: center; padding: 32px 8px; }
.form-success:focus { outline: none; }
.form-success h3 { font-size: 1.5rem; margin-bottom: 8px; }
.form-success p { color: var(--muted); }
.success-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 20px; border-radius: 50%; background: color-mix(in srgb, var(--ok) 16%, transparent); }
.success-icon svg { width: 26px; height: 26px; }

/* --- Undersidor (integritetspolicy, tack) ------------------------------- */

.page { padding-block: clamp(48px, 8vw, 96px); }
.page h1 { font-size: clamp(2.1rem, 4vw + .8rem, 3.2rem); margin-bottom: 12px; }
.page h2 { font-size: 1.3rem; margin: 40px 0 10px; letter-spacing: -0.015em; }
.page p { color: var(--muted); max-width: 66ch; }
.page .updated { font-size: .9375rem; }
.page .draft {
  margin-top: 24px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--text); font-size: .9375rem;
}
.page .back { display: inline-flex; margin-top: 48px; }
.page-center { text-align: center; }
.page-center p { margin-inline: auto; }

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

.site-footer { padding-block: 48px; border-top: 1px solid var(--border); font-size: .9375rem; }
.footer-inner { display: grid; gap: 24px; }
.footer-brand { font-weight: 720; letter-spacing: -0.02em; }
.footer-tagline, .footer-copy, .footer-label { color: var(--muted); }
.footer-links { display: grid; gap: 8px; }
.footer-links a { color: var(--text); }
.footer-links a:hover { color: var(--accent); }
@media (min-width: 760px) {
  .footer-inner { grid-template-columns: 1.4fr 1fr auto; align-items: start; }
}
