/* Granska avtalet – a contract on a desk, marked up by a careful reader.
   Grotesk for the interface, serif for anything that is (or quotes) the contract itself. */
@font-face { font-family: "Schibsted Grotesk"; src: url("/fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("/fonts/source-serif-4-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("/fonts/source-serif-4-latin-wght-italic.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; }

:root {
  --desk: #e9edf2;
  --paper: #ffffff;
  --ink: #16233b;
  --ink-2: #2c3b57;
  --muted: #586378;
  --line: #cfd6df;
  --line-soft: #e2e7ed;
  --mark: #ffe15a;
  --high: #b8321f;
  --high-bg: #fbe3df;
  --med: #8a5a00;
  --med-bg: #fff0b8;
  --low: #2d6a4b;
  --low-bg: #dff0e6;
  --focus: #2b6cdf;
  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --r-sheet: 3px;
  --r-ui: 10px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
body { margin: 0; background: var(--desk); color: var(--ink); font: 400 1.0625rem/1.55 var(--sans); }
img, svg { display: block; max-width: 100%; }
a { color: var(--ink); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.12; margin: 0 0 0.5em; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); font-weight: 750; }
h3 { font-size: 1.125rem; font-weight: 700; letter-spacing: 0; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { top: 12px; }
[hidden] { display: none !important; }
.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Header ---------- */
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.125rem; text-decoration: none; letter-spacing: -0.01em; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--mark); font: 700 1.25rem/1 var(--serif); }
.head-nav { display: flex; gap: 22px; font-size: 0.9375rem; }
.head-nav a { text-decoration: none; color: var(--ink-2); }
.head-nav a:hover { text-decoration: underline; }
@media (max-width: 720px) { .head-nav { display: none; } }

/* ---------- Hero ---------- */
.hero { padding: 28px 0 72px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 56px; align-items: start; }
.hero h1 { font-size: clamp(2.6rem, 6.4vw, 4.6rem); font-weight: 850; letter-spacing: -0.035em; line-height: 0.98; margin: 18px 0 20px; }
.lede { font-size: 1.1875rem; color: var(--ink-2); max-width: 34em; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 40px; } .hero { padding-bottom: 48px; } }

/* ---------- Upload form ---------- */
.upload { margin-top: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-ui); padding: 22px; box-shadow: 0 1px 0 var(--line-soft), 0 12px 32px -18px rgba(22, 35, 59, 0.35); }
.field { border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }
.field > label, .field > legend, .label { display: block; font-weight: 650; margin-bottom: 8px; font-size: 0.9875rem; }
select, input[type="text"], textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid #aab4c2; border-radius: 8px; padding: 11px 12px;
}
select { appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px; background-repeat: no-repeat; }
textarea { font: 0.9375rem/1.5 var(--serif); resize: vertical; margin-top: 10px; }
input[type="text"] { margin-top: 10px; }
.roles { display: flex; flex-wrap: wrap; gap: 8px; }
.roles label { position: relative; }
.roles input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.roles span { display: inline-block; padding: 9px 14px; border: 1px solid #aab4c2; border-radius: 999px; font-size: 0.9375rem; cursor: pointer; background: var(--paper); }
.roles input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.roles input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop { position: relative; border: 1.5px dashed #9aa6b6; border-radius: var(--r-ui); background: #f6f8fb; transition: border-color 0.15s, background 0.15s; }
.drop.is-over { border-color: var(--ink); background: #eef2f8; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop input:focus-visible + .drop-body { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r-ui); }
.drop-body { display: grid; justify-items: center; gap: 4px; padding: 22px 16px; text-align: center; pointer-events: none; }
.drop-main { font-weight: 650; }
.drop-hint { font-size: 0.875rem; color: var(--muted); }
.file-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.file-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 0.9375rem; padding: 8px 10px; background: #f3f5f8; border-radius: 6px; }
.file-list .size { color: var(--muted); white-space: nowrap; }
.link-btn { background: none; border: 0; padding: 0; margin-top: 10px; font: inherit; font-size: 0.9375rem; color: var(--ink-2); text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer; }
.tech-error { background: var(--high-bg); border-left: 4px solid var(--high); border-radius: 8px; padding: 12px 14px; margin-bottom: 18px; color: #6e2013; font-size: 0.9375rem; }
.tech-error p { margin: 0; }
.tech-error-title { font-weight: 750; color: var(--high); margin-bottom: 2px !important; }
.form-error { color: var(--high); background: var(--high-bg); border-radius: 8px; padding: 10px 12px; font-size: 0.9375rem; }
.form-note { font-size: 0.875rem; color: var(--muted); margin: 12px 0 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font: 700 1.0625rem/1 var(--sans); border-radius: 999px; padding: 16px 26px; border: 2px solid var(--ink); cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--ink); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--ink-2); }
.btn-secondary { background: var(--paper); color: var(--ink); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-small { padding: 10px 16px; font-size: 0.9375rem; }

/* ---------- The marked-up sheet (hero specimen) ---------- */
.specimen { margin: 0; position: relative; }
.sheet { background: var(--paper); border-radius: var(--r-sheet); padding: 34px 34px 18px; box-shadow: 0 1px 1px rgba(22, 35, 59, 0.08), 0 24px 48px -28px rgba(22, 35, 59, 0.45); transform: rotate(0.6deg); }
.sheet-title { font: 600 1.25rem/1.2 var(--serif); text-align: center; letter-spacing: 0.02em; margin-bottom: 26px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.clause { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 18px; margin-bottom: 20px; }
.clause-text { font: 400 1rem/1.62 var(--serif); margin: 0; color: #1d2433; }
mark { color: inherit; padding: 0.05em 0.1em; border-radius: 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.m-high { background: linear-gradient(transparent 8%, rgba(232, 92, 70, 0.32) 8%, rgba(232, 92, 70, 0.32) 92%, transparent 92%); }
.m-med { background: linear-gradient(transparent 8%, rgba(255, 210, 40, 0.6) 8%, rgba(255, 210, 40, 0.6) 92%, transparent 92%); }
.m-low { background: linear-gradient(transparent 8%, rgba(74, 170, 116, 0.28) 8%, rgba(74, 170, 116, 0.28) 92%, transparent 92%); }
.note { margin: 0; font-size: 0.8125rem; line-height: 1.4; padding-left: 12px; border-left: 3px solid; }
.note-sev { display: block; font-weight: 750; margin-bottom: 2px; }
.n-high { border-color: var(--high); color: #6e2013; } .n-high .note-sev { color: var(--high); }
.n-med { border-color: #d9a400; color: #5a4100; } .n-med .note-sev { color: var(--med); }
.n-low { border-color: var(--low); color: #234d38; } .n-low .note-sev { color: var(--low); }
.specimen figcaption { font-size: 0.875rem; color: var(--muted); margin-top: 16px; text-align: center; }
@media (max-width: 560px) {
  .sheet { padding: 24px 18px 8px; transform: none; }
  .clause { grid-template-columns: 1fr; gap: 8px; }
}
@media (prefers-reduced-motion: no-preference) {
  .specimen mark { background-size: 0% 100%; background-repeat: no-repeat; animation: highlight 0.7s ease-out forwards; }
  .specimen .clause:nth-of-type(1) mark { animation-delay: 0.25s; }
  .specimen .clause:nth-of-type(2) mark { animation-delay: 0.6s; }
  .specimen .clause:nth-of-type(3) mark { animation-delay: 0.95s; }
  .specimen .note { opacity: 0; animation: note-in 0.4s ease-out forwards; }
  .specimen .clause:nth-of-type(1) .note { animation-delay: 0.7s; }
  .specimen .clause:nth-of-type(2) .note { animation-delay: 1.05s; }
  .specimen .clause:nth-of-type(3) .note { animation-delay: 1.4s; }
}
@keyframes highlight { to { background-size: 100% 100%; } }
@keyframes note-in { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Sections ---------- */
.band { padding: 72px 0; border-top: 1px solid var(--line); }
.band-plain { background: var(--paper); }
.steps { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-top: 52px; }
.steps li::before { content: counter(step); position: absolute; top: 0; left: 0; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--ink); font-weight: 800; }
.steps p { color: var(--ink-2); margin: 0; }
@media (max-width: 800px) { .steps { grid-template-columns: 1fr; gap: 24px; } }
.two-col { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 56px; align-items: start; }
.two-col > div > p { color: var(--ink-2); max-width: 30em; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; gap: 20px; } }
.type-list { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.type-list > div { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.type-list dt { font-weight: 700; }
.type-list dd { margin: 2px 0 0; color: var(--muted); font-size: 0.9375rem; }
@media (max-width: 560px) { .type-list { grid-template-columns: 1fr; } }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.facts li { padding-left: 22px; position: relative; color: var(--ink-2); }
.facts li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 10px; height: 10px; background: var(--mark); box-shadow: 0 0 0 1.5px var(--ink); border-radius: 2px; }
.facts b { color: var(--ink); }
details { border-top: 1px solid var(--line-soft); }
details:last-of-type { border-bottom: 1px solid var(--line-soft); }
summary { cursor: pointer; padding: 16px 32px 16px 0; font-weight: 650; list-style: none; position: relative; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 4px; top: 12px; font-size: 1.5rem; font-weight: 400; line-height: 1; }
details[open] summary::after { content: "–"; }
details p { color: var(--ink-2); max-width: 62ch; }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--line); padding: 32px 0 40px; font-size: 0.875rem; color: var(--muted); }
.site-foot a { color: var(--ink-2); }
.foot-nav { display: flex; gap: 18px; margin: 8px 0; }
.foot-legal, .foot-note { margin: 0; }

/* ---------- Review page ---------- */
.review-wrap { max-width: 880px; padding-bottom: 72px; }
.review-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 20px; margin: 8px 0 20px; font-size: 0.9375rem; }
.expiry { color: var(--muted); margin: 0; }
.doc { background: var(--paper); border-radius: var(--r-sheet); box-shadow: 0 1px 1px rgba(22, 35, 59, 0.08), 0 24px 48px -30px rgba(22, 35, 59, 0.4); padding: clamp(22px, 5vw, 52px); }
.doc-meta { color: var(--muted); font-size: 0.9375rem; margin-bottom: 6px; }
.doc h1 { font-size: clamp(1.75rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -0.025em; }
.doc h2 { font-size: 1.375rem; margin-top: 44px; }
.risk { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; padding: 6px 12px; border-radius: 999px; font-size: 0.9375rem; margin-bottom: 18px; }
.risk::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.risk-high { background: var(--high-bg); color: var(--high); }
.risk-medium { background: var(--med-bg); color: var(--med); }
.risk-low { background: var(--low-bg); color: var(--low); }
.summary { font: 400 1.1875rem/1.6 var(--serif); color: #1d2433; max-width: 62ch; }
.terms { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 28px; margin: 24px 0 0; }
.terms > div { border-top: 1px solid var(--line-soft); padding: 10px 0; }
.terms dt { font-size: 0.875rem; color: var(--muted); }
.terms dd { margin: 2px 0 0; font-weight: 650; }
.tally { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 6px 0 18px; font-size: 0.9375rem; color: var(--ink-2); }
.tally span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: var(--c); }

.finding { border-left: 4px solid var(--c); padding: 4px 0 4px 20px; margin: 22px 0 30px; }
.finding[data-sev="high"] { --c: var(--high); } .finding[data-sev="medium"] { --c: #d9a400; } .finding[data-sev="low"] { --c: var(--low); }
.tally .t-high { --c: var(--high); } .tally .t-medium { --c: #d9a400; } .tally .t-low { --c: var(--low); }
.f-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.f-head h3 { margin: 0; font-size: 1.1875rem; }
.f-sev { font-size: 0.8125rem; font-weight: 750; color: var(--c); }
.finding[data-sev="medium"] .f-sev { color: var(--med); }
.f-loc { font-size: 0.875rem; color: var(--muted); }
.f-quote { font: italic 400 1rem/1.55 var(--serif); margin: 0 0 12px; padding: 10px 14px; background: #f6f7f9; border-radius: 4px; color: #333a48; }
.f-quote::before { content: "”"; } .f-quote::after { content: "”"; }
.finding p { margin: 0 0 8px; max-width: 66ch; }
.f-label { font-weight: 700; }
.f-law { font-size: 0.9375rem; color: var(--ink-2); }
.simple-list { padding-left: 1.2em; margin: 0; }
.simple-list li { margin-bottom: 10px; max-width: 66ch; }
.simple-list b { display: block; }

/* Locked: placeholder text only (the real text is not in the page) */
.locked { position: relative; margin-top: 8px; }
.locked-fake { filter: blur(5px); user-select: none; pointer-events: none; opacity: 0.75; }
.locked-fake .finding { margin: 18px 0 26px; }
.locked-fake p { font-size: 0.9375rem; }
.unlock { position: relative; margin: -40px auto 0; max-width: 520px; background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; padding: 24px; box-shadow: 0 20px 50px -24px rgba(22, 35, 59, 0.5); }
.unlock h2 { margin: 0 0 6px; font-size: 1.375rem; }
.unlock-list { padding-left: 1.2em; margin: 10px 0 16px; color: var(--ink-2); }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 0.875rem; color: var(--ink-2); margin: 14px 0 16px; line-height: 1.45; }
.consent input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--ink); }
.price { font-size: 0.9375rem; color: var(--muted); margin: 0; }
.pay-state { text-align: center; }
.qr { width: 220px; height: 220px; margin: 14px auto; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.wait { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 0.9375rem; margin: 6px 0 12px; }
.dot-pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.8); } }
.pay-actions { display: grid; gap: 10px; margin-top: 8px; }
.pay-error { color: var(--high); background: var(--high-bg); border-radius: 8px; padding: 10px 12px; font-size: 0.9375rem; text-align: left; }

.status-card { background: var(--paper); border-radius: var(--r-sheet); padding: clamp(28px, 6vw, 56px); text-align: center; box-shadow: 0 24px 48px -30px rgba(22, 35, 59, 0.4); }
.status-card h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 800; }
.status-card p { color: var(--ink-2); max-width: 46ch; margin-left: auto; margin-right: auto; }
.scan { position: relative; width: 132px; height: 168px; margin: 8px auto 26px; background: #fff; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.scan i { position: absolute; left: 16px; right: 16px; height: 6px; background: #e3e8ef; border-radius: 2px; }
.scan::after { content: ""; position: absolute; left: 0; right: 0; height: 26px; background: linear-gradient(transparent, rgba(255, 225, 90, 0.75)); animation: scan 1.8s ease-in-out infinite alternate; }
@keyframes scan { from { top: -26px; } to { top: 100%; } }

.doc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line-soft); }
.disclaimer { font-size: 0.875rem; color: var(--muted); margin-top: 24px; }
.paid-note { background: var(--low-bg); color: #1f4f37; border-radius: 8px; padding: 12px 14px; font-size: 0.9375rem; margin-bottom: 24px; }

/* ---------- Text pages (villkor, integritet, kvitto) ---------- */
.text-page { max-width: 760px; background: var(--paper); border-radius: var(--r-sheet); padding: clamp(24px, 5vw, 52px); margin: 8px auto 72px; }
.text-page h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 800; }
.text-page h2 { font-size: 1.25rem; margin-top: 32px; }
.text-page p, .text-page li { max-width: 66ch; color: var(--ink-2); }
.receipt-table { width: 100%; border-collapse: collapse; margin: 18px 0 24px; }
.receipt-table th, .receipt-table td { text-align: left; padding: 10px 0; border-top: 1px solid var(--line-soft); vertical-align: top; }
.receipt-table th { font-weight: 500; color: var(--muted); width: 40%; }
.receipt-table tr:nth-last-child(2) td { font-weight: 750; }

@media print {
  body { background: #fff; font-size: 11pt; }
  .site-head, .site-foot, .review-bar, .doc-actions, .skip, .no-print { display: none !important; }
  .doc, .text-page { box-shadow: none; padding: 0; margin: 0; max-width: none; }
  .finding { break-inside: avoid; }
  a { text-decoration: none; }
}
